File tree Expand file tree Collapse file tree 3 files changed +4
-1
lines changed
matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto Expand file tree Collapse file tree 3 files changed +4
-1
lines changed Original file line number Diff line number Diff line change 1+ Faster Olm decrypt when there is a lot of existing sessions
Original file line number Diff line number Diff line change @@ -66,7 +66,8 @@ internal class OlmSessionStore @Inject constructor(private val store: IMXCryptoS
6666 olmSessions.getOrPut(deviceKey) { mutableListOf () }.forEach { cached ->
6767 getSafeSessionIdentifier(cached.olmSession)?.let { cachedSessionId ->
6868 if (! persistedKnownSessions.contains(cachedSessionId)) {
69- persistedKnownSessions.add(cachedSessionId)
69+ // as it's in cache put in on top
70+ persistedKnownSessions.add(0 , cachedSessionId)
7071 }
7172 }
7273 }
Original file line number Diff line number Diff line change @@ -715,6 +715,7 @@ internal class RealmCryptoStore @Inject constructor(
715715 return doWithRealm(realmConfiguration) {
716716 it.where<OlmSessionEntity >()
717717 .equalTo(OlmSessionEntityFields .DEVICE_KEY , deviceKey)
718+ .sort(OlmSessionEntityFields .LAST_RECEIVED_MESSAGE_TS , Sort .DESCENDING )
718719 .findAll()
719720 .mapNotNull { sessionEntity ->
720721 sessionEntity.sessionId
You can’t perform that action at this time.
0 commit comments