Automattic / Automattic/kue

Strange attempts and backoff Behavior

Open
#768 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.4k
Forks
858
PR merge metrics
No merged PRs in 30d

Description

After months in production I see a strange behavior of `attempts` and `backoff`.

This is my code where I create the jobs using `attempts` and `backoff`.

``` js
queue.create('message_outgoing', data)
.attempts(3)
.backoff({type: 'exponential'})
.removeOnComplete(true)
.save(function(error){
if(error) {
return done(error)
}
done()
})
```

And this is the some jobs in `active` state with strange value of attempts.

![screen shot 2015-12-03 at 9 58 21 am](https://cloud.githubusercontent.com/assets/313285/11550700/d5625e26-99a4-11e5-8eff-5a99cbb186f0.png)

Also this is the `attempts` value inside one of the job object.

``` js
"attempts": {
"made": 65,
"remaining": -62,
"max": 3
}
```

Why the attempts made more than the maximum value?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the behavior with the JavaScript queue snippet and the reported attempts object, then trace how attempts and exponential backoff are updated for active jobs. Done means identifying why made exceeds max and either confirming the intended behavior or correcting it with a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.