mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-17 04:20:00 +03:00
avoid duplicate userId on key download
This commit is contained in:
parent
87de51b184
commit
49d33f3a4b
1 changed files with 3 additions and 2 deletions
|
@ -172,13 +172,14 @@ internal class EventDecryptor @Inject constructor(
|
||||||
toUnwedge
|
toUnwedge
|
||||||
.chunked(100) // safer to chunk if we ever have lots of wedged devices
|
.chunked(100) // safer to chunk if we ever have lots of wedged devices
|
||||||
.forEach { wedgedList ->
|
.forEach { wedgedList ->
|
||||||
|
val groupedByUserId = wedgedList.groupBy { it.userId }
|
||||||
// lets download keys if needed
|
// lets download keys if needed
|
||||||
withContext(coroutineDispatchers.io) {
|
withContext(coroutineDispatchers.io) {
|
||||||
deviceListManager.downloadKeys(wedgedList.map { it.userId }, false)
|
deviceListManager.downloadKeys(groupedByUserId.keys.toList(), false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the matching devices
|
// find the matching devices
|
||||||
wedgedList.groupBy { it.userId }
|
groupedByUserId
|
||||||
.map { groupedByUser ->
|
.map { groupedByUser ->
|
||||||
val userId = groupedByUser.key
|
val userId = groupedByUser.key
|
||||||
val wedgeSenderKeysForUser = groupedByUser.value.map { it.senderKey }
|
val wedgeSenderKeysForUser = groupedByUser.value.map { it.senderKey }
|
||||||
|
|
Loading…
Add table
Reference in a new issue