-
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
[BUG] moveToCompleted is throwing errors #1381
Comments
Please |
Hi, this wont help. Basically I want to have a setup for debugging, where I always add a job to a clean queue from start, without the need to manually remove them via a DB manager. const Queue = require('bull');
const queue = new Queue('testqueue', 'redis://127.0.0.1:6379');
const testQueue = async () => {
const jobs = await queue.getJobs();
jobs.forEach(async job => {
// sometimes returned job is null, so I need a check
if(job){
await job.moveToCompleted('completed', true, true);
}
});
await queue.empty();
// this should be the only job now in the new queue
await queue.add({ test: 'data' });
};
testQueue(); The above code works, if the redis DB is completely empty. As soon as I restart the code on a non empty redis db, it yields the following error:
Edit: At least it looks like all existing jobs are removed: |
My worker code looks a bit different and there somehow no jobs are removed at all: const queue = new BullQueue('testqueue', 'redis://127.0.0.1:6379', {
settings: {
backoffStrategies: {
botConnector
}
}
});
const jobs = await this.queue.getJobs();
jobs.forEach(async job => {
try {
await job.moveToCompleted('completed', true, true);
} catch (err) {
// ignore err
}
});
await this.queue.empty();
await this.queue.add({test: 'job'}, {
attempts: 99999,
backoff: {
type: 'botConnector'
}
});
this.queue.process(10, async(data => {
//do processing here
return;
})); |
Got it, add Looks like there is indeed a bug, PS I've also answered here #1323 how to completely remove all queue-related keys from Redis which can be helpful for unit tests. |
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. |
Description
When trying to move all jobs to completed, I get an exception. However I do not understand why this is happening, maybe I am using something wrrong.
Minimal, Working Test code to reproduce the issue.
yields:
Bull version
3.10.0
The text was updated successfully, but these errors were encountered: