Fix stuck timeline pagination because of too many membership events

Requires https://github.com/matrix-org/matrix-rust-sdk/pull/1314
This commit is contained in:
manuroe
2023-01-03 09:11:20 +01:00
committed by Stefan Ceriu
parent a5637b09cc
commit 9ed66f0808
6 changed files with 12 additions and 7 deletions

View File

@@ -55,7 +55,7 @@ struct MockRoomProxy: RoomProxyProtocol {
.failure(.failedAddingTimelineListener)
}
func paginateBackwards(count: UInt) async -> Result<Void, RoomProxyError> {
func paginateBackwards(count: UInt) async -> Result<UInt, RoomProxyError> {
.failure(.failedPaginatingBackwards)
}

View File

@@ -142,7 +142,7 @@ class RoomProxy: RoomProxyProtocol {
// }
}
func paginateBackwards(count: UInt) async -> Result<Void, RoomProxyError> {
func paginateBackwards(count: UInt) async -> Result<UInt, RoomProxyError> {
guard backPaginationOutcome?.moreMessages != false else {
return .failure(.noMoreMessagesToBackPaginate)
}
@@ -152,7 +152,7 @@ class RoomProxy: RoomProxyProtocol {
try self.room.paginateBackwards(limit: UInt16(count))
}
update(backPaginationOutcome: outcome)
return .success(())
return .success(UInt(outcome.numUpdates))
} catch {
return .failure(.failedPaginatingBackwards)
}

View File

@@ -56,7 +56,7 @@ protocol RoomProxyProtocol {
func addTimelineListener(listener: TimelineListener) -> Result<Void, RoomProxyError>
func paginateBackwards(count: UInt) async -> Result<Void, RoomProxyError>
func paginateBackwards(count: UInt) async -> Result<UInt, RoomProxyError>
func sendMessage(_ message: String, inReplyToEventId: String?) async -> Result<Void, RoomProxyError>

View File

@@ -99,7 +99,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol {
// MARK: - Private
fileprivate func updateRoomsWithDiffs(_ diffs: [SlidingSyncViewRoomsListDiff]) {
MXLog.info("Received diffs")
MXLog.info("Received \(diffs.count) diffs")
rooms = diffs
.reduce(rooms) { currentItems, diff in

View File

@@ -72,8 +72,12 @@ class RoomTimelineProvider: RoomTimelineProviderProtocol {
MXLog.info("Started back pagination request")
switch await roomProxy.paginateBackwards(count: count) {
case .success:
MXLog.info("Finished back pagination request")
case .success(let numUpdates):
MXLog.info("Finished back pagination request. Got \(numUpdates) updates")
if numUpdates == 0 {
backPaginationPublisher.send(false)
}
return .success(())
case .failure(let error):
MXLog.error("Failed back pagination request with error: \(error)")

1
changelog.d/394.bugfix Normal file
View File

@@ -0,0 +1 @@
Fix stuck timeline pagination because of too many membership events