Automattic / Automattic/kue

kue.Job.rangeByState returns empty jobs array for non zero start index

Open
#1,067 3 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

kue.Job.rangeByState works as expected when i pass in Zero (based index) as its 2nd parameter
``` javascript
//Works as expected
kue.Job.rangeByState( 'complete', 0, n, 'asc', function( err, jobs ) {
jobs.forEach( function( job ) {
job.remove( function(){
console.log( 'removed ', job.id );
});
});
});
```
However any non-zero value seems to return a empty jobs array
``` javascript
//any non zero index 'i' makes the fun() return empty jobs array
kue.Job.rangeByState( 'complete', i, n, 'asc', function( err, jobs ) {
//jobs is an empty array
});
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing kue.Job.rangeByState with a non-zero second argument and compare it with the documented zero-index case. Trace the rangeByState entry point and verify that the callback returns the expected jobs for non-zero start indexes while preserving the existing zero-index behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.