diff --git a/types/bull/bull-tests.tsx b/types/bull/bull-tests.tsx index 22cd0dc638..916e8fe69a 100644 --- a/types/bull/bull-tests.tsx +++ b/types/bull/bull-tests.tsx @@ -209,6 +209,7 @@ myQueue.on('active', (job: Queue.Job) => { const nextJobId: Queue.JobId = val[1]; } }); + job.moveToCompleted('done', true, false); job.moveToFailed({ message: "Call to external service failed!" }, true); job.moveToFailed(new Error('test error'), true); @@ -222,6 +223,13 @@ myQueue.on('active', (job: Queue.Job) => { job.discard(); }); +// Close queues + +myQueue.close(); + +const doNotWaitForJobs = true; +myQueue.close(doNotWaitForJobs); + // Get Redis clients const clients = myQueue.clients; diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index 434378acea..8032b01ddf 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -258,7 +258,7 @@ declare namespace Bull { * Moves a job to the `completed` queue. Pulls a job from 'waiting' to 'active' * and returns a tuple containing the next jobs data and id. If no job is in the `waiting` queue, returns null. */ - moveToCompleted(returnValue?: string, ignoreLock?: boolean): Promise<[any, JobId] | null>; + moveToCompleted(returnValue?: string, ignoreLock?: boolean, notFetch?: boolean): Promise<[any, JobId] | null>; /** * Moves a job to the `failed` queue. Pulls a job from 'waiting' to 'active' @@ -611,7 +611,7 @@ declare namespace Bull { * `close` can be called from anywhere, with one caveat: * if called from within a job handler the queue won't close until after the job has been processed */ - close(): Promise; + close(doNotWaitJobs?: boolean): Promise; /** * Returns a promise that will return the job instance associated with the jobId parameter.