fix: shard Dispatcher DO per session instead of global singleton#83
fix: shard Dispatcher DO per session instead of global singleton#83
Conversation
Code ReviewOverviewThis PR shards the Positive Aspects
Issues / Concerns1. The
|
|
Addressed #1 and #3 in the latest push. Re #2 (DO cleanup): This DO writes no storage ( Re #4 (tests): Agreed this is low risk for a one-line change. The sharding behavior will be validated in staging with a live transcription meeting. |
Code ReviewOverviewThis PR fixes a correctness bug: the The Issues to Address1. DO resource accumulation (potential leak) With per-session DOs, a new DO instance is created for every session. On session close, the code correctly closes the WebSocket connection to the DO: dispatcherWs?.close(1000, 'Session ended');But this only closes the WebSocket connection — it does not destroy the DO instance itself. Cloudflare DOs that use
2.
3. Unbounded reconnect loop
Positive Notes
SummaryThe core fix (global singleton → per-session DO) is correct and necessary. The main follow-up question before merging is whether the DispatcherDO cleans itself up after a session ends, to avoid unbounded DO accumulation over time. The Review generated with Claude Code |
Code Review — Updated AnalysisWhat This PR DoesShards the Positive Notes
Remaining Concerns1.
|
…odge CF auto-redaction
Code Review — Final PassThis review addresses the current diff state after the follow-up commits, given that three earlier review rounds have already covered the main concerns. What's in the diff (current state)
One remaining nit: query param name vs. PR descriptionThe PR description says:
But the code passes `http://dispatcher/websocket?meetingId=${encodeURIComponent(sessionId)}`This is a doc/code mismatch. Pre-existing issues (acknowledged in earlier rounds, not blocking this PR)
SummaryThe core change is correct, minimal, and addresses a real isolation bug. The DO-cleanup concern from earlier rounds is resolved (DispatcherDO is stateless). The only actionable item here is aligning the query param name with the PR description. Ready to merge after that minor clarification. Review generated with Claude Code |
…ads ctx.id.name instead)
Code Review — Final State (after all 5 commits)The PR has iterated well through review. Here is an assessment of the final diff vs. the full commit history. Final diff is cleanThe net change across all 5 commits is exactly what the PR title says: replace What's addressed
One small note on
|
Replace
idFromName('global')withidFromName(sessionId)for the TranscriptionDispatcher DO. Each transcription session gets its own isolated DO instead of sharing one global instance.Follow-ups in this branch
sessionId(5907dff) — avoids everyone-colliding-on-'unknown'when the client doesn't supply one.Test plan
29fdac7f— no container rebuild)