Skip to content

fix: await flushSave on WebSocket close to prevent data loss#165

Closed
kptdobe wants to merge 1 commit into
mainfrom
fix/do-ws-close-async
Closed

fix: await flushSave on WebSocket close to prevent data loss#165
kptdobe wants to merge 1 commit into
mainfrom
fix/do-ws-close-async

Conversation

@kptdobe

@kptdobe kptdobe commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

`webSocketClose` and `webSocketError` were synchronous but called `handleWebSocketClose` → `closeConn` which is async and does `await doc.flushSave()` on the last connection. Without the await, pending document saves are silently dropped when the last client disconnects.

Changes

  • `handleWebSocketClose` → async, awaits `closeConn`
  • `DocRoom.webSocketClose` → async, awaits `handleWebSocketClose`
  • `DocRoom.webSocketError` → async, awaits `handleWebSocketClose`
  • Tests updated to await the now-async close/error handlers

🤖 Generated with Claude Code

…onnect

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: kptdobe <acapt@adobe.com>
@kptdobe

kptdobe commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #172 which consolidates all DO best-practice fixes.

@kptdobe kptdobe closed this Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants