perf(session-projection): skip history reads for in-order events

This commit is contained in:
_Kerman committed 2026-08-21 14:09:39 +08:00
1 parent c26ca6acb6
commit 89b5bc276f
1 file changed
+4 -2
@@ -529,8 +529,10 @@ export class SessionProjectionRegistry extends Service {
registration.cells.set(session, cell)
}
if (cell.observedSeq >= event.seq) continue
for (const prior of session.events.slice(cell.observedSeq + 1, event.seq)) {
this.applyToCell(registration, session, cell, prior)
if (cell.observedSeq + 1 < event.seq) {
for (const prior of session.events.slice(cell.observedSeq + 1, event.seq)) {
this.applyToCell(registration, session, cell, prior)
}
}
this.applyToCell(registration, session, cell, event)
}