mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-20 00:51:17 -08:00
improve the caching i think
This commit is contained in:
1 parent
4032d1f184
commit
dcdb0b60f3
1 file changed
+18
-11
+18
-11
@@ -219,6 +219,8 @@ export class SlidingSyncManager {
|
||||
|
||||
private sidebarCacheReconciled = false;
|
||||
|
||||
private sidebarCacheReconciliationQueued = false;
|
||||
|
||||
private readonly serverMembershipRoomIds = new Set<string>();
|
||||
|
||||
private initialSyncCompleted = false;
|
||||
@@ -528,20 +530,25 @@ export class SlidingSyncManager {
|
||||
}
|
||||
|
||||
private reconcileSidebarCacheMembership(): void {
|
||||
if (this.sidebarCacheReconciled) return;
|
||||
this.sidebarCacheReconciled = true;
|
||||
if (this.sidebarCacheReconciled || this.sidebarCacheReconciliationQueued) return;
|
||||
this.sidebarCacheReconciliationQueued = true;
|
||||
|
||||
const removedRoomIds = this.sidebarCache.reconcileRooms(this.serverMembershipRoomIds);
|
||||
removedRoomIds.forEach((roomId) => {
|
||||
this.mx.getRoom(roomId)?.updateMyMembership(KnownMembership.Leave);
|
||||
this.unsubscribeFromRoom(roomId);
|
||||
});
|
||||
void this.cacheHydrationPromise.then(() => {
|
||||
if (this.disposed || this.sidebarCacheReconciled) return;
|
||||
this.sidebarCacheReconciled = true;
|
||||
|
||||
if (removedRoomIds.length > 0) {
|
||||
debugLog.info('sync', 'Removed stale rooms from the sliding sync sidebar cache', {
|
||||
removedRoomCount: removedRoomIds.length,
|
||||
const removedRoomIds = this.sidebarCache.reconcileRooms(this.serverMembershipRoomIds);
|
||||
removedRoomIds.forEach((roomId) => {
|
||||
this.mx.getRoom(roomId)?.updateMyMembership(KnownMembership.Leave);
|
||||
this.unsubscribeFromRoom(roomId);
|
||||
});
|
||||
}
|
||||
|
||||
if (removedRoomIds.length > 0) {
|
||||
debugLog.info('sync', 'Removed stale rooms from the sliding sync sidebar cache', {
|
||||
removedRoomCount: removedRoomIds.length,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public getDiagnostics(): SlidingSyncDiagnostics {
|
||||
|
||||
Reference in new issue
Block a user