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
Prev Previous commit
Next Next commit
fix(sync): check pending structs and resync if needed
This check will happen every 30 seconds by default.
So on average it will take 15 seconds after missing a message.

This is also in "sync" with new autosaved versions
becoming available roughly every 30 seconds.

Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Jul 1, 2025
commit bb7bde0fd47325fa6e6fb0590994a18296336e7f
8 changes: 6 additions & 2 deletions src/services/y-websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export class WebsocketProvider extends Observable {
params = {},
protocols = [],
WebSocketPolyfill = WebSocket,
resyncInterval = -1,
resyncInterval = 30_000,
maxBackoffTime = 2500,
disableBc = false,
} = {},
Expand Down Expand Up @@ -345,7 +345,11 @@ export class WebsocketProvider extends Observable {
if (resyncInterval > 0) {
this._resyncInterval = /** @type {any} */ (
setInterval(() => {
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
if (
this.ws
&& this.ws.readyState === WebSocket.OPEN
&& doc.store.pendingStructs
) {
// resend sync step 1
const encoder = encoding.createEncoder()
encoding.writeVarUint(encoder, messageSync)
Expand Down