Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Miniflare 3] Remove unused handleQueue() function from entry worker #678

Merged
merged 1 commit into from
Sep 11, 2023

Conversation

mrbbot
Copy link
Contributor

@mrbbot mrbbot commented Sep 6, 2023

With #656, the Queues dispatcher is now implemented as part of the broker Durable Object. We no longer send message batches directly from Node.js, so can remove queue handling from the entry worker.

Note the magic proxy enqueues messages through queue producer bindings like regular workers, so never used this endpoint directly.

With #656, the Queues dispatcher is now implemented as part of the
broker Durable Object. We no longer send message batches directly
from Node.js, so can remove queue handling from the entry worker.

Note the magic proxy enqueues messages through queue producer
bindings like regular workers, so never used this endpoint directly.
@mrbbot mrbbot requested a review from a team September 6, 2023 20:25
@changeset-bot
Copy link

changeset-bot bot commented Sep 6, 2023

⚠️ No Changeset found

Latest commit: f4ecf45

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No changes to tests because this is never used and makes no externally measurable change to behaviour?

@mrbbot
Copy link
Contributor Author

mrbbot commented Sep 11, 2023

@petebacondarwin exactly, this code has been moved here: 👍

#dispatchBatch(workerName: string, batch: QueueMessage[]) {
const bindingName =
`${QueueBindings.SERVICE_WORKER_PREFIX}${workerName}` as const;
const maybeService = this.env[bindingName];
assert(
maybeService !== undefined,
`Expected ${bindingName} service binding`
);
const messages = batch.map(({ id, timestamp, body }) => {
if (body.contentType === "v8") {
return { id, timestamp, serializedBody: body.body };
} else {
return { id, timestamp, body: body.body };
}
});
// @ts-expect-error `Fetcher#queue()` types haven't been updated for
// `serializedBody` yet, and don't allow `number` for `timestamp`, even
// though that's permitted at runtime
return maybeService.queue(this.name, messages);
}

@mrbbot mrbbot merged commit 7c4387a into tre Sep 11, 2023
@mrbbot mrbbot deleted the bcoll/tre-removed-unused-queues-code branch September 11, 2023 16:38
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.

3 participants