fix: Durable Object best practices — all 9 fixes#172
Merged
Conversation
Signed-off-by: kptdobe <acapt@adobe.com>
…completes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…onnect Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: kptdobe <acapt@adobe.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: kptdobe <acapt@adobe.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: kptdobe <acapt@adobe.com>
…ernation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: kptdobe <acapt@adobe.com>
…test stub Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Jun 11, 2026
bosschaert
approved these changes
Jun 15, 2026
adobe-bot
pushed a commit
that referenced
this pull request
Jun 15, 2026
## [1.7.1](v1.7.0...v1.7.1) (2026-06-15) ### Bug Fixes * Durable Object best practices — all 9 fixes ([#172](#172)) ([0ac4fac](0ac4fac))
Collaborator
|
🎉 This PR is included in version 1.7.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Consolidates all Durable Object best-practice fixes into a single reviewable PR. Replaces #163, #164, #165, #166, #167, #168, #169, #170, #171.
Changes
High severity — data correctness
ctx.waitUntil(initSession(...))— prevents the DO from being evicted before async session setup completeswebSocketClose/webSocketErrormade async — ensuresflushSaveis awaited on last disconnect, preventing silent data lossawait messageListener(...)inhandleWebSocketMessage— flush ack is no longer sent before the save completesMedium severity — modernisation
DocRoomextendsDurableObjectbase class — prerequisite for RPC; addscloudflare:workersstub so the Mocha test suite keeps workingcompatibility_datebumped to2024-04-03— minimum date to enable RPC on DO stubsLow severity — correctness and performance
setTimeoutfor deferred da-admin reload replaced withctx.waitUntil(promise)— timer now survives DO hibernation;ctxthreaded throughsetupWSConnection→getYDoc→bindStatecloseConn.bind(this)→closeConn—thisisundefinedat module scope in strict mode; the bind was a no-opreadStateuses targetedstorage.get()calls instead ofstorage.list()— avoids loading the full document (potentially MBs of chunks) in the "not found" and "name mismatch" cold-start casesDocRoomTest plan
npm test)initSessionandwebSocketMessageinDocRoomnow correctly combinethis.ctx?.storage(from refactor: extend DurableObject base class to unlock RPC #167) with the newctxparameter (from fix: use ctx.waitUntil for deferred da-admin reload to survive hibernation #170)🤖 Generated with Claude Code