Skip to content

fix(cloudflare): calculate retries not attempts #16834

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

stayallive
Copy link

The message.attempts property starts at 1 so we were calculating the number of attempts not the number of retries. Attempt 2 is the first retry not attempt 1.

Currently the retry count is the same as the number of messages in the batch this way:

Screenshot 2025-07-07 at 23 40 48

Additionally this causes the error rate to be quite nice and I have been assured my code is not THAT bad:

Screenshot 2025-07-07 at 23 41 43

See: https://developers.cloudflare.com/queues/configuration/javascript-apis/

The `message.attempts` property starts at 1 so we were calculating the number of attempts not the number of retries. Since attempt 2 is the first retry.
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

nice, thank you!

@mydea
Copy link
Member

mydea commented Jul 8, 2025

There seems to be a linting issue, could you run yarn fix, then this should be good to go - thank you 🙏

@stayallive
Copy link
Author

Ah, yeah of course. 2.1 GB of node_modules later I think it ran enough to fix the linting 😎

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