TokenChunkEventPersistor: always link all matching chunks
The previous fix only works around the issue when it is detected. This may require re-entering the room once when it gets stuck. If we ensure proper linking from the beginning, hopefully we don't run into any issues at all.
This commit is contained in:
parent
682f4c35d2
commit
6878a973ed
@ -109,8 +109,14 @@ internal class TokenChunkEventPersistor @Inject constructor(
|
|||||||
this.nextChunk = nextChunk
|
this.nextChunk = nextChunk
|
||||||
this.prevChunk = prevChunk
|
this.prevChunk = prevChunk
|
||||||
}
|
}
|
||||||
nextChunk?.prevChunk = currentChunk
|
val allNextChunks = ChunkEntity.findAll(realm, roomId, prevToken = nextToken)
|
||||||
prevChunk?.nextChunk = currentChunk
|
val allPrevChunks = ChunkEntity.findAll(realm, roomId, nextToken = prevToken)
|
||||||
|
allNextChunks?.forEach {
|
||||||
|
it.prevChunk = currentChunk
|
||||||
|
}
|
||||||
|
allPrevChunks?.forEach {
|
||||||
|
it.nextChunk = currentChunk
|
||||||
|
}
|
||||||
if (receivedChunk.events.isEmpty() && !receivedChunk.hasMore()) {
|
if (receivedChunk.events.isEmpty() && !receivedChunk.hasMore()) {
|
||||||
handleReachEnd(roomId, direction, currentChunk)
|
handleReachEnd(roomId, direction, currentChunk)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user