Skip to content

Commit

Permalink
Use diff init if eventsToSync <= board.items
Browse files Browse the repository at this point in the history
  • Loading branch information
raimohanska committed Feb 3, 2024
1 parent 639f48e commit 6239384
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion backend/src/websocket-sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export async function addSessionToBoard(
boardState.sessions = [...boardState.sessions, session]
}
const initDiff = initAtSerial && boardState.board.serial - initAtSerial
if (initDiff && initDiff > 200) {
if (initDiff && initDiff > Object.keys(boardState.board.items).length) {
console.log(`Sending fresh board state for board ${boardId} instead of diff (${initDiff} events to sync)`)
initAsNew(session, boardId, accessLevel, boardState)
} else if (initAtSerial) {
Expand Down

0 comments on commit 6239384

Please sign in to comment.