[@types/bull] Update Queue and Job definitions (#39244)

* add argument for queue.close(boolean)

* fixes #38619 add `notFetch` parameter

* revert formatting

* reapply changes w/o formatting

* undo formatting (again)

* look, I finally saved without formatting :)

* revert formatting

* save without formatting
This commit is contained in:
Doug Ayers
2019-10-22 13:33:39 -07:00
committed by Wesley Wigham
parent 62973e7b32
commit 1db75c0e2e
2 changed files with 10 additions and 2 deletions
+8
View File
@@ -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;
+2 -2
View File
@@ -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<void>;
close(doNotWaitJobs?: boolean): Promise<void>;
/**
* Returns a promise that will return the job instance associated with the jobId parameter.