mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-17 11:48:51 +03:00
Pagination : avoid breaking timeline when paginating twice from same token (race condition)
This commit is contained in:
parent
8777d13d8b
commit
b5650b2b8f
1 changed files with 6 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue