mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Pagination : avoid breaking timeline when paginating twice from same token (race condition)
This commit is contained in:
parent
8777d13d8b
commit
b5650b2b8f
@ -128,6 +128,12 @@ internal class TokenChunkEventPersistor @Inject constructor(private val monarchy
|
||||
nextToken = receivedChunk.start
|
||||
prevToken = receivedChunk.end
|
||||
}
|
||||
|
||||
if (ChunkEntity.find(realm, roomId, nextToken = nextToken) != null || ChunkEntity.find(realm, roomId, prevToken = prevToken) != null) {
|
||||
Timber.v("Already inserted - SKIP")
|
||||
return@tryTransactionSync
|
||||
}
|
||||
|
||||
val prevChunk = ChunkEntity.find(realm, roomId, nextToken = prevToken)
|
||||
val nextChunk = ChunkEntity.find(realm, roomId, prevToken = nextToken)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user