Avoid launching coroutine for nothing.
This commit is contained in:
parent
56986c3a77
commit
837590104d
@ -42,10 +42,9 @@ internal class StreamEventsManager @Inject constructor() {
|
|||||||
listeners.remove(listener)
|
listeners.remove(listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun dispatchLiveEventReceived(event: Event, roomId: String, initialSync: Boolean) {
|
fun dispatchLiveEventReceived(event: Event, roomId: String) {
|
||||||
Timber.v("## dispatchLiveEventReceived ${event.eventId}")
|
Timber.v("## dispatchLiveEventReceived ${event.eventId}")
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
if (!initialSync) {
|
|
||||||
listeners.forEach {
|
listeners.forEach {
|
||||||
tryOrNull {
|
tryOrNull {
|
||||||
it.onLiveEvent(roomId, event)
|
it.onLiveEvent(roomId, event)
|
||||||
@ -53,7 +52,6 @@ internal class StreamEventsManager @Inject constructor() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fun dispatchPaginatedEventReceived(event: Event, roomId: String) {
|
fun dispatchPaginatedEventReceived(event: Event, roomId: String) {
|
||||||
Timber.v("## dispatchPaginatedEventReceived ${event.eventId}")
|
Timber.v("## dispatchPaginatedEventReceived ${event.eventId}")
|
||||||
|
@ -423,7 +423,9 @@ internal class RoomSyncHandler @Inject constructor(
|
|||||||
val isInitialSync = insertType == EventInsertType.INITIAL_SYNC
|
val isInitialSync = insertType == EventInsertType.INITIAL_SYNC
|
||||||
|
|
||||||
eventIds.add(event.eventId)
|
eventIds.add(event.eventId)
|
||||||
liveEventService.get().dispatchLiveEventReceived(event, roomId, isInitialSync)
|
if (!isInitialSync) {
|
||||||
|
liveEventService.get().dispatchLiveEventReceived(event, roomId)
|
||||||
|
}
|
||||||
|
|
||||||
if (event.isEncrypted() && !isInitialSync) {
|
if (event.isEncrypted() && !isInitialSync) {
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user