Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(sync): preserve queue if sendRemainingSteps fails
During a network disconnect
Yjs-websocket notices missing awareness messages and closes the connection.
In this case the remaining steps can also not be send out and the request fails.
Preserve the queue so we can use it once the network is back up.

Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud authored and backportbot-nextcloud[bot] committed Dec 18, 2023
commit dc3fddc5d355b4ebe56380436c580d2446ac9fac
3 changes: 3 additions & 0 deletions src/services/WebSocketPolyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ export default function initWebSocketPolyfill(syncService, fileId, initialSessio

#sendRemainingSteps() {
if (this.#queue.length) {
let outbox = []
return syncService.sendStepsNow(() => {
outbox = [...this.#queue]
const data = {
steps: this.#steps,
awareness: this.#awareness,
Expand All @@ -136,6 +138,7 @@ export default function initWebSocketPolyfill(syncService, fileId, initialSessio
return data
})?.catch(err => {
logger.error(err)
this.#queue = [...outbox, ...this.#queue]
})
}
}
Expand Down