mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 15:36:38 +01:00
Adjusted subscription cleanup to avoid mutating the watcher map while iterating it, preventing the ConcurrentModificationException when accounts switch
This commit is contained in:
@@ -186,11 +186,11 @@ class AccountFollowsLoaderSubAssembler(
|
||||
}
|
||||
|
||||
// removes accounts that are not being subscribed anymore.
|
||||
accountUpdatesJobMap.forEach {
|
||||
if (it.key !in uniqueSubscribedAccounts.keys) {
|
||||
endWatcher(it.key)
|
||||
}
|
||||
}
|
||||
// Cancel watchers for accounts no longer observed using a snapshot to avoid CME
|
||||
accountUpdatesJobMap.keys
|
||||
.toList()
|
||||
.filter { it !in uniqueSubscribedAccounts.keys }
|
||||
.forEach { endWatcher(it) }
|
||||
}
|
||||
|
||||
private val accountUpdatesJobMap = mutableMapOf<User, Job>()
|
||||
|
||||
Reference in New Issue
Block a user