PR remrarks

This commit is contained in:
ariskotsomitopoulos 2021-11-17 19:56:06 +02:00
parent 9972dbc278
commit 8015ffee42
3 changed files with 4 additions and 9 deletions

View file

@ -29,7 +29,6 @@ internal class DefaultEventService @Inject constructor(
override suspend fun getEvent(roomId: String, eventId: String): Event {
val event = getEventTask.execute(GetEventTask.Params(roomId, eventId))
event.ageLocalTs = event.unsignedData?.age?.let { System.currentTimeMillis() - it }
// Fast lane to the call event processors: try to make the incoming call ring faster
if (callEventProcessor.shouldProcessFastLane(event.getClearType())) {
callEventProcessor.processFastLane(event)

View file

@ -59,6 +59,8 @@ internal class DefaultGetEventTask @Inject constructor(
}
}
event.ageLocalTs = event.unsignedData?.age?.let { System.currentTimeMillis() - it }
return event
}
}

View file

@ -18,7 +18,6 @@ package org.matrix.android.sdk.internal.session.sync.handler.room
import com.zhuinden.monarchy.Monarchy
import io.realm.Realm
import io.realm.RealmConfiguration
import org.matrix.android.sdk.api.session.crypto.CryptoService
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
import org.matrix.android.sdk.api.session.events.model.Event
@ -44,7 +43,6 @@ import org.matrix.android.sdk.internal.session.permalinks.PermalinkFactory
import org.matrix.android.sdk.internal.session.room.send.LocalEchoEventFactory
import org.matrix.android.sdk.internal.session.room.timeline.GetEventTask
import org.matrix.android.sdk.internal.util.awaitTransaction
import timber.log.Timber
import javax.inject.Inject
/**
@ -55,7 +53,6 @@ import javax.inject.Inject
internal class ThreadsAwarenessHandler @Inject constructor(
private val permalinkFactory: PermalinkFactory,
private val cryptoService: CryptoService,
@SessionDatabase private val realmConfiguration: RealmConfiguration,
@SessionDatabase private val monarchy: Monarchy,
private val getEventTask: GetEventTask
) {
@ -87,7 +84,7 @@ internal class ThreadsAwarenessHandler @Inject constructor(
if (eventList.isNullOrEmpty()) return
val threadsToFetch = emptyMap<String, String>().toMutableMap()
Realm.getInstance(realmConfiguration).use { realm ->
Realm.getInstance(monarchy.realmConfiguration).use { realm ->
eventList.asSequence()
.filter {
isThreadEvent(it) && it.roomId != null
@ -130,10 +127,7 @@ internal class ThreadsAwarenessHandler @Inject constructor(
*/
private suspend fun fetchEvent(eventId: String, roomId: String): Event? {
return runCatching {
Timber.i("------> Fetching event[$eventId]....")
getEventTask.execute(GetEventTask.Params(roomId = roomId, eventId = eventId)).apply {
unsignedData?.age?.let { System.currentTimeMillis() - it }
}
getEventTask.execute(GetEventTask.Params(roomId = roomId, eventId = eventId))
}.fold(
onSuccess = {
it