diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/timeline/TimelineEventDecryptor.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/timeline/TimelineEventDecryptor.kt index 7c014f9e80..b8be58779c 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/timeline/TimelineEventDecryptor.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/room/timeline/TimelineEventDecryptor.kt @@ -72,13 +72,6 @@ internal class TimelineEventDecryptor( } fun requestDecryption(eventId: String) { - synchronized(existingRequests) { - if (eventId in existingRequests) { - Timber.d("Skip Decryption request for event $eventId, already requested") - return - } - existingRequests.add(eventId) - } synchronized(unknownSessionsFailure) { for (eventIds in unknownSessionsFailure.values) { if (eventId in eventIds) { @@ -87,6 +80,13 @@ internal class TimelineEventDecryptor( } } } + synchronized(existingRequests) { + if (eventId in existingRequests) { + Timber.d("Skip Decryption request for event $eventId, already requested") + return + } + existingRequests.add(eventId) + } executor?.execute { Realm.getInstance(realmConfiguration).use { realm -> processDecryptRequest(eventId, realm)