-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Jobs are undefined in the queue #1386
Jobs are undefined in the queue #1386
Comments
I cannot reproduce this. Can you please also attach your code which creating this queue? Is this error thrown for all jobs of single |
@stansv please contact me at manast@taskforce.sh |
Hi sorry for coming back late, had very busy days.. This is how we initialise the queue. const queue = new Queue(
'jobs',
`redis://${process.env.REDIS_HOST}:${process.env.REDIS_PORT}`,
{
settings: {
stalledInterval: 5000,
maxStalledCount: 9999,
lockDuration: 60000,
lockRenewTime: 30000
}
}
) More information: our setup consist of 2 different systems. One is an API which simply creates job tasks and pushes them to Bull. The other one is a worker server which processes the jobs. We stop running jobs via the moveToCompleted function which is called with ignoreLock: true on the API side. Then the worker server listens to a global:completed event and calls the done callback to finish job processing on the worker side. When the job is restarted again (meaning there is already a done job in redis), we do these calls: await job.moveToCompleted('removed', true);
await job.remove();
await queue.add(
{
...payload
},
{
jobId: payload.id,
attempts: 99999,
backoff: {
type: 'customBackoff'
}
}
) |
I still cannot reproduce your error.. There are a bunch of pitfalls around usage of I believe that the best for you would be to reorganize your code so that there's no need to forcibly "stop" jobs, and remove them. Implement some check in process function so that job can know it's requested to complete and let it finish normally. |
We have a check in the process function. We listen to the global:completed event and call the cone callback as soon as its called with the jobId of the currently executed job. |
My failing code is: const j: Job = await transporter.queue.getJob(jobId);
if (j && await j.isActive()) { // this line fails
return;
}
queue.add(...) I get following stacktrace:
I'm not sure what is happening here and how to debug it. |
You must wait for the queue to be ready, try with await transporter.queue.isReady(); |
This should be added in the docs. ^ @manast ❤️ |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@entrptaher in reality the call to |
We are seeing this too. |
## [3.29.1](v3.29.0...v3.29.1) (2021-08-26) ### Bug Fixes * protect getJob with isReady, fixes [#1386](#1386) ([2f27faa](2f27faa))
🎉 This issue has been resolved in version 3.29.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
Hi, we started noticing errors in our production environment. Unfortunately this is the only piece of information I can share with you:
Also we noticed that some jobs in the queue are becoming an empty object.
Minimal code to reproduce
Bull version
3.10.0
The text was updated successfully, but these errors were encountered: