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

MQ-605: Extend miniflare's queues simulator to support delayed delivery #5570

Conversation

sesteves
Copy link
Contributor

@sesteves sesteves commented Apr 9, 2024

This patch updates the miniflare's queue broker to support delayed delivery of messages, both when sending the message from a producer and when retrying the message from a consumer.
The implementation is based on miniflare's timers, and currently there is no support for specifying the delivery delay in queue settings for a producer.

What this PR solves / how to test

Fixes #MQ-605

Author has addressed the following

@sesteves sesteves requested a review from a team as a code owner April 9, 2024 17:20
Copy link

changeset-bot bot commented Apr 9, 2024

🦋 Changeset detected

Latest commit: ce508b7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
miniflare Minor
wrangler Minor
@cloudflare/pages-shared Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Contributor

github-actions bot commented Apr 9, 2024

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8999854516/npm-package-wrangler-5570

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/5570/npm-package-wrangler-5570

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8999854516/npm-package-wrangler-5570 dev path/to/script.js
Additional artifacts:
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8999854516/npm-package-create-cloudflare-5570 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8999854516/npm-package-cloudflare-kv-asset-handler-5570
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8999854516/npm-package-miniflare-5570
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8999854516/npm-package-cloudflare-pages-shared-5570
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8999854516/npm-package-cloudflare-vitest-pool-workers-5570

Note that these links will no longer work once the GitHub Actions artifact expires.


[email protected] includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20240419.0
workerd 1.20240419.0 1.20240419.0
workerd --version 1.20240419.0 2024-04-19

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

@sesteves sesteves force-pushed the sesteves/mq-605-support-for-delayed-messages-in-queues branch from a8086d7 to 1d83a86 Compare April 9, 2024 17:45
@sesteves sesteves force-pushed the sesteves/mq-605-support-for-delayed-messages-in-queues branch 3 times, most recently from 1d06b5b to 1832c9e Compare April 12, 2024 15:55
@penalosa
Copy link
Contributor

penalosa commented Apr 23, 2024

Approved pending e2e tests (passed, see #5690)

@sesteves sesteves force-pushed the sesteves/mq-605-support-for-delayed-messages-in-queues branch 2 times, most recently from 5adaca9 to e98a2c8 Compare April 23, 2024 12:20
@sesteves sesteves force-pushed the sesteves/mq-605-support-for-delayed-messages-in-queues branch from e98a2c8 to ba3ad4a Compare May 6, 2024 15:35
Copy link
Contributor

@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.

This looks great. Thanks for updating Miniflare!
I left a couple of nits but not blocking landing if you are keen merge today.

Copy link
Contributor

@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.

Actually the change to the configuration API concerns me. We even document it publicly here: https://github.com/cloudflare/workers-sdk/blob/main/packages/miniflare/README.md#queues

@sesteves sesteves force-pushed the sesteves/mq-605-support-for-delayed-messages-in-queues branch from ba3ad4a to 4ae46ff Compare May 7, 2024 13:53
@@ -311,8 +311,7 @@ test("retries messages", async (t) => {
const log = new TestLog(t);
const mf = new Miniflare({
log,

queueProducers: { QUEUE: "queue" },
queueProducers: { QUEUE: { queueName: "queue" } },
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is no longer needed, right?

@sesteves sesteves force-pushed the sesteves/mq-605-support-for-delayed-messages-in-queues branch 2 times, most recently from ab34535 to ee0d6b9 Compare May 7, 2024 16:55
@petebacondarwin petebacondarwin self-assigned this May 7, 2024
sesteves and others added 4 commits May 7, 2024 21:11
This patch updates the miniflare's queue broker to support delayed
delivery of messages, both when sending the message from a producer and
when retrying the message from a consumer.
The implementation is based on miniflare's timers, and currently there
is no support for specifying the delivery delay in queue settings for a
producer.
@petebacondarwin petebacondarwin force-pushed the sesteves/mq-605-support-for-delayed-messages-in-queues branch from ee0d6b9 to ce508b7 Compare May 8, 2024 09:57
@petebacondarwin petebacondarwin merged commit 66bdad0 into cloudflare:main May 8, 2024
25 checks passed
@workers-devprod workers-devprod mentioned this pull request May 7, 2024
edmundhung added a commit that referenced this pull request Sep 18, 2024
* fix(miniflare): Fix regression introduced in #5570

* Update .changeset/cool-beans-applaud.md

Co-authored-by: Edmund Hung <[email protected]>

---------

Co-authored-by: Edmund Hung <[email protected]>
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