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

Improve the logic of "attemptsMade" #1002

Closed
manast opened this issue Jan 19, 2022 · 1 comment
Closed

Improve the logic of "attemptsMade" #1002

manast opened this issue Jan 19, 2022 · 1 comment
Labels
enhancement New feature or request released

Comments

@manast
Copy link
Contributor

manast commented Jan 19, 2022

Introduction

Currently "attemptsMade" is coupled to the retry mechanism, as it is only incremented when a retry has been issued. This is semantically awkward as in that this number does not really represent the number of times a job has been attempted to be processed, for example, a worker may die causing its current job to stall. This job will be picked up later by a worker and effectively-being processed a second time, but "attemptsMade" will still be 0.

Requirements

The "attemptsMade" field should be incremented when and only a job is moved to active. This will better reflect its semantical intent and also be more efficient with functions like "retry all failed jobs", which otherwise would require to update the "attemptsMade" field for every job, making it much more slower.

Since attemptsMade will now be 1 after the first time a job is processed, the retry logic must also take this change into account so that jobs are retried automatically at the max number specified in the "attempts" settings. Note that this change is not 100% backwards compatible, since an older job processed with a precious version of BullMQ will be retried 1 more time with the new code, but I do not think this slight change motivates a major version release, a minor would be OK IMHO.

@manast manast added the enhancement New feature or request label Jan 19, 2022
github-actions bot pushed a commit that referenced this issue Jan 25, 2022
## [1.66.1](v1.66.0...v1.66.1) (2022-01-25)

### Bug Fixes

* **job:** increase attemptsMade when moving job to active ([#1009](#1009)) fixes [#1002](#1002) ([0974ae0](0974ae0))
@github-actions
Copy link

🎉 This issue has been resolved in version 1.66.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

No branches or pull requests

1 participant