forked from GitHub-Mirror/riotX-android
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
|
nextToken = receivedChunk.start
|
||||||
prevToken = receivedChunk.end
|
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 prevChunk = ChunkEntity.find(realm, roomId, nextToken = prevToken)
|
||||||
val nextChunk = ChunkEntity.find(realm, roomId, prevToken = nextToken)
|
val nextChunk = ChunkEntity.find(realm, roomId, prevToken = nextToken)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user