Look at next jobs to run
- Dominant language
- JavaScript
- Stars
- 9.4k
- Forks
- 858
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I'd need to look at the number of the next jobs to run, for example in the next 15 minutes, I did something like this, but I need to loop any job and if they grow up I think it could take too much to run:
```
var from = moment().utc().format('x'),
to = moment().add(15, 'minutes').utc().format('x'),
i = 0;
kue.Job.rangeByType('jobname', 'delayed', 0, -1, 'desc', function(err, jobs) {
if (err) return console.log(err);
_.each(jobs, function(job) {
if (job && job.promote_at) {
var promote = parseInt(job.promote_at, 10);
if (promote > from && promote <= to) i += 1;
}
});
});
```
Is there a better way?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the kue.Job.rangeByType entry point and the delayed-job handling it exposes. Determine whether the existing API can efficiently report jobs promoted within a time window without iterating the full range; done means a supported, documented approach or a clearly scoped API change, with relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, redis
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100