From c8dc68c14631c6aa6bf2ff2344378e5658b3d3bd Mon Sep 17 00:00:00 2001 From: Levi Bostian Date: Thu, 16 Jan 2020 10:15:05 -0600 Subject: [PATCH] bull - add missing whenCurrentJobsFinished typings (#41625) * add whenCurrentJobsFinished to bull module * bump version of bull package --- types/bull/bull-tests.tsx | 5 +++++ types/bull/index.d.ts | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/types/bull/bull-tests.tsx b/types/bull/bull-tests.tsx index 2314b06546..cd733a6482 100644 --- a/types/bull/bull-tests.tsx +++ b/types/bull/bull-tests.tsx @@ -165,6 +165,11 @@ videoQueue.add({ video: 'http://example.com/video1.mov' }, { jobId: 1 }) // error }); +pdfQueue.whenCurrentJobsFinished() +.then(() => { + // Jobs finished +}); + ////////////////////////////////////////////////////////////////////////////////// // // Typed Event Handlers diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index eb2a5b3f08..98315611d6 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for bull 3.10 +// Type definitions for bull 3.12 // Project: https://github.com/OptimalBits/bull // Definitions by: Bruno Grieder // Cameron Crothers @@ -17,6 +17,7 @@ // DoYoung Ha // Borys Kupar // Remko Klein +// Levi Bostian // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -846,6 +847,11 @@ declare namespace Bull { * @param list String with all redis clients */ parseClientList(list: string): Redis.Redis[]; + + /** + * Returns a promise that resolves when active jobs are finished + */ + whenCurrentJobsFinished(): Promise; } type EventCallback = () => void;