Skip to content

Commit

Permalink
Update src/plugins/liveobjects/liveobjects.ts
Browse files Browse the repository at this point in the history
Co-authored-by: Mike Christensen <[email protected]>
  • Loading branch information
VeskeR and mschristensen authored Nov 8, 2024
1 parent ef7b975 commit f44b2d2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/plugins/liveobjects/liveobjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ export class LiveObjects {
const timeserial = DefaultTimeserial.calculateTimeserial(this._client, msgRegionalTimeserial);

if (this._syncInProgress) {
// the client receives state messages in realtime over the channel concurrently with the SYNC sequence,
// which means that some of the state messages may already be applied by the realtime in the SYNC sequence once it's ended.
// to avoid re-applying those state messages (for example double counting COUNTER_INC operation),
// we buffer incoming state operation messsages while SYNC is in progress, and apply them once SYNC has ended.
// The client receives state messages in realtime over the channel concurrently with the SYNC sequence.
// Some of the incoming state messages may have already been applied to the state objects described in

Check failure on line 100 in src/plugins/liveobjects/liveobjects.ts

View workflow job for this annotation

GitHub Actions / lint

Mixed spaces and tabs
// the SYNC sequence, but others may not; therefore we must buffer these messages so that we can apply

Check failure on line 101 in src/plugins/liveobjects/liveobjects.ts

View workflow job for this annotation

GitHub Actions / lint

Mixed spaces and tabs
// them to the state objects once the SYNC is complete. To avoid double-counting, the buffered operations

Check failure on line 102 in src/plugins/liveobjects/liveobjects.ts

View workflow job for this annotation

GitHub Actions / lint

Mixed spaces and tabs
// are applied according to the state object's regional timeserial, which reflects the regional timeserial

Check failure on line 103 in src/plugins/liveobjects/liveobjects.ts

View workflow job for this annotation

GitHub Actions / lint

Mixed spaces and tabs
// of the state message that was last applied to that state object.

Check failure on line 104 in src/plugins/liveobjects/liveobjects.ts

View workflow job for this annotation

GitHub Actions / lint

Mixed spaces and tabs
stateMessages.forEach((x) =>
this._bufferedStateOperations.push({ stateMessage: x, regionalTimeserial: timeserial }),
);
Expand Down

0 comments on commit f44b2d2

Please sign in to comment.