mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #14751 from JProgrammer/bull-finished
Add finished function to Job
This commit is contained in:
@@ -98,3 +98,18 @@ videoQueue.process( ( job: VideoJob ) => { // don't forget to remove the done ca
|
||||
// If the job throws an unhandled exception it is also handled correctly
|
||||
throw new Error( 'some unexpected error' );
|
||||
} );
|
||||
|
||||
|
||||
var addVideo1Job = videoQueue.add( { video: 'http://example.com/video1.mov' } );
|
||||
|
||||
addVideo1Job.then((video1Job) => {
|
||||
// When job has successfully be placed in the queue the job is returned
|
||||
// then wait for completion
|
||||
return video1Job.finished();
|
||||
})
|
||||
.then(() => {
|
||||
// video1Job completed successfully
|
||||
})
|
||||
.catch((err) => {
|
||||
// error
|
||||
});
|
||||
|
||||
Vendored
+9
-2
@@ -1,6 +1,6 @@
|
||||
// Type definitions for bull 1.0.0
|
||||
// Type definitions for bull 2.1.2
|
||||
// Project: https://github.com/OptimalBits/bull
|
||||
// Definitions by: Bruno Grieder <https://github.com/bgrieder>
|
||||
// Definitions by: Bruno Grieder <https://github.com/bgrieder>, Cameron Crothers <https://github.com/JProgrammer>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="redis" />
|
||||
@@ -47,6 +47,13 @@ declare module "bull" {
|
||||
* @returns {Promise} A promise that resolves when the job is scheduled for retry.
|
||||
*/
|
||||
retry(): Promise<void>;
|
||||
|
||||
/**
|
||||
* Returns a promise the resolves when the job has been finished.
|
||||
* TODO: Add a watchdog to check if the job has finished periodically.
|
||||
* since pubsub does not give any guarantees.
|
||||
*/
|
||||
finished(): Promise<void>;
|
||||
}
|
||||
|
||||
export interface Backoff {
|
||||
|
||||
Reference in New Issue
Block a user