fix(cloudflare): dispatch for multiple queue consumers#466
Open
focux wants to merge 1 commit into
Open
Conversation
096d77e to
ae9a332
Compare
john-royal
approved these changes
May 29, 2026
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.
Summary
Fix
WorkerRuntimeContext.dispatchso it runs every listener that returns an Effect for a Worker event type instead of returning after the first one.This matters for
Cloudflare.messages(queue).subscribe(...): each queue subscription registers aqueuelistener, and that listener checksbatch.queueinside the returned Effect. Since every queue listener returns an Effect before that internal queue-name check runs, the first registered queue listener can swallow events for later queue subscriptions by no-oping on queue mismatch.Changes
WorkerRuntimeContextunit test proving all listeners for an event type are invokedCloudflare.messages(...).subscribe(...)path catches this regression tooVerification
bun tsc -b packages/alchemy/tsconfig.test.jsongit diff --checkNote: local
bun vitest run ...currently fails before test collection in this checkout because the installedrolldown/oxfmtpath hits a Bunnode:util.styleTextcompatibility error. The new tests typecheck and follow the existing@/…test import convention.