Job on complete event
- Dominant language
- JavaScript
- Stars
- 9.4k
- Forks
- 858
- PR merge metrics
- No merged PRs in 30d
Description
When fetching a job like this -
```
kue.Job.get(someId, (err, job) => {
job.on('complete', () => { // never called
debug('on get')
// do stuff after job is complete
})
job.inactive()
})
```
here this event handler is never called, probably because `kue.Job.get` doesn't return an object that has that listener. **Is there a way to listen to job events when fetching events like this ?
or a way to listen to `complete` event for a particular job (by job id)**
This works fine, but doesn't serve the purpose -
```
const job = queue.create('name', {
title
})
.delay(1200000)
.attempts(3)
.save(err => {
if(err)
return
// save job.id
})
job.on('complete', () => {
debug('on create')
})
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the kue.Job.get and queue.create entry points, then compare how the fetched job and newly created job handle job.on('complete') and inactive(). Reproduce the example with a saved job id and verify whether completion for that particular job can be observed; done means the documented fetch-by-id flow reliably triggers or exposes the requested completion event.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, redis
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100