Adopt the new search backfill client interfaces.

This commit is contained in:
Stefan Ceriu
2026-09-28 18:54:02 +03:00
parent 8aae06d3ae
commit 790bf0a44e
3 changed files with 82 additions and 0 deletions
@@ -56,6 +56,8 @@ class ClientProxy: ClientProxyProtocol {
private var delegateHandle: TaskHandle?
private var searchBackfillTaskHandle: TaskHandle?
// These following summary providers both operate on the same allRooms() list but
// can apply their own filtering and pagination
private(set) var roomSummaryProvider: RoomSummaryProviderProtocol
@@ -473,6 +475,25 @@ class ClientProxy: ClientProxyProtocol {
await transitionServices(to: .suspended).value
}
func startSearchBackfill(strategy: SearchBackfillStrategy) {
if strategy == .foreground, isSearchBackfillRunning {
return
}
MXLog.info("Starting search backfill with strategy: \(strategy)")
searchBackfillTaskHandle?.cancel()
searchBackfillTaskHandle = client.runSearchBackfill(strategy: strategy)
}
func stopSearchBackfill() {
searchBackfillTaskHandle?.cancel()
searchBackfillTaskHandle = nil
}
var isSearchBackfillRunning: Bool {
searchBackfillTaskHandle?.isFinished() == false
}
func expireSyncSessions() async {
await syncService.expireSessions()
}
@@ -1188,6 +1209,8 @@ class ClientProxy: ClientProxyProtocol {
case .suspended:
updateHomeserverReachability()
stopSearchBackfill()
MXLog.info("Stopping sync")
await syncService.stop()
MXLog.info("Sync stopped")
@@ -187,6 +187,12 @@ protocol ClientProxyProtocol: AnyObject {
func pauseServices() async
func startSearchBackfill(strategy: SearchBackfillStrategy)
func stopSearchBackfill()
var isSearchBackfillRunning: Bool { get }
func expireSyncSessions() async
func accountURL(action: AccountManagementAction) async -> URL?