Skip to content

Commit

Permalink
TODO comment
Browse files Browse the repository at this point in the history
  • Loading branch information
David Robertson committed Apr 17, 2023
1 parent 4ba80d2 commit 9fdb001
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions state/accumulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ func (a *Accumulator) Initialise(roomID string, state []json.RawMessage) (res In
}
unknownRoom := snapshotID == 0
if !unknownRoom {
// TODO: suppose Alice's poller has already initialised this room. Then Bob
// shows up and we make a brand new poller for him. When his poller initial
// syncs, the state block will be passed here. If that block includes a
// state event that Alice's poller hasn't seen, we'll now end up adding it
// to the DB here---without a snapshot ID---instead of in an Accumulate
// call (with a snapshot ID).
//
// Can we prevent this by passing in a bool initialPollerSync arg?
// (Return early if !initialPollerSync and !unknownRoom)
const warningMsg = "Accumulator.Initialise called when current snapshot already exists. Patching in events"
logger.Warn().Str("room_id", roomID).Int64("snapshot_id", snapshotID).Msg(warningMsg)
sentry.WithScope(func(scope *sentry.Scope) {
Expand Down

0 comments on commit 9fdb001

Please sign in to comment.