[BUG] moveToCompleted is throwing errors
Created by: akirilyuk
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.
const Queue = require('bull');
const queue = new Queue('testqueue', 'redis://127.0.0.1:6379');
const testQueue = async () => {
queue.add({ test: 'data' });
const jobs = await queue.getJobs();
jobs.forEach(async job => {
await job.moveToCompleted('completed', true, true);
});
};
testQueue();
yields:
(node:4296) UnhandledPromiseRejectionWarning: TypeError: job.queue.client.moveToFinished is not a function at Object.moveToFinished (/Users//node_modules/bull/lib/scripts.js:167:29) at Object.moveToCompleted (/Users/node_modules/bull/lib/scripts.js:194:20) at Job.moveToCompleted (/Users//node_modules/bull/lib/job.js:194:18) at jobs.forEach (/Users//src/queueTest.js:9:15) at Array.forEach () at testQueue (/Users/**/src/queueTest.js:8:8) at process._tickCallback (internal/process/next_tick.js:68:7)
Bull version
3.10.0