Session Cache Implementation
Nucleic-Session: B2346642-3353-4BD5-9DE2-A8B77BD66C98 Co-authored-by: Nucleic <[email protected]>
This commit is contained in:
@@ -521,16 +521,19 @@ final class RemoteStore: ObservableObject {
|
|||||||
// instead of truncating it to the host's 200-event tail.
|
// instead of truncating it to the host's 200-event tail.
|
||||||
self.openEvents = Self.mergedEvents(self.openEvents, snap.recentEvents)
|
self.openEvents = Self.mergedEvents(self.openEvents, snap.recentEvents)
|
||||||
self.openApprovals = snap.pendingApprovals
|
self.openApprovals = snap.pendingApprovals
|
||||||
|
self.persistOpenTranscript()
|
||||||
}
|
}
|
||||||
cb.openEvents = { [weak self] batch in
|
cb.openEvents = { [weak self] batch in
|
||||||
guard let self, hostID == self.openSessionHostID, batch.sessionID == self.openSessionID else { return }
|
guard let self, hostID == self.openSessionHostID, batch.sessionID == self.openSessionID else { return }
|
||||||
self.openEvents.append(contentsOf: batch.events)
|
self.openEvents.append(contentsOf: batch.events)
|
||||||
|
self.persistOpenTranscript()
|
||||||
}
|
}
|
||||||
cb.openBackfill = { [weak self] batch in
|
cb.openBackfill = { [weak self] batch in
|
||||||
guard let self, hostID == self.openSessionHostID, batch.sessionID == self.openSessionID else { return }
|
guard let self, hostID == self.openSessionHostID, batch.sessionID == self.openSessionID else { return }
|
||||||
// Full-history backfill precedes what's on screen — merge by seq so it slots in above the
|
// Full-history backfill precedes what's on screen — merge by seq so it slots in above the
|
||||||
// tail rather than appending out of order.
|
// tail rather than appending out of order.
|
||||||
self.openEvents = Self.mergedEvents(self.openEvents, batch.events)
|
self.openEvents = Self.mergedEvents(self.openEvents, batch.events)
|
||||||
|
self.persistOpenTranscript()
|
||||||
}
|
}
|
||||||
cb.openDiff = { [weak self] diff in
|
cb.openDiff = { [weak self] diff in
|
||||||
guard let self, hostID == self.openSessionHostID, diff.sessionID == self.openSessionID else { return }
|
guard let self, hostID == self.openSessionHostID, diff.sessionID == self.openSessionID else { return }
|
||||||
|
|||||||
Reference in New Issue
Block a user