Add in existingRequest only if not filtered

This commit is contained in:
Benoit Marty 2019-10-22 12:45:36 +02:00
parent 4204ab262c
commit 3abce34484
1 changed files with 7 additions and 7 deletions

View File

@ -72,13 +72,6 @@ internal class TimelineEventDecryptor(
} }
fun requestDecryption(eventId: String) { 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) { synchronized(unknownSessionsFailure) {
for (eventIds in unknownSessionsFailure.values) { for (eventIds in unknownSessionsFailure.values) {
if (eventId in eventIds) { 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 { executor?.execute {
Realm.getInstance(realmConfiguration).use { realm -> Realm.getInstance(realmConfiguration).use { realm ->
processDecryptRequest(eventId, realm) processDecryptRequest(eventId, realm)