bull: Add Queue#getWaiting (#23148)

* bull: Add Queue#getWaiting

* bull: Add isLocal flags for pause/resume

* bull: Fix JobCounts#waiting
This commit is contained in:
Matthew Scharley
2018-01-31 05:55:19 +11:00
committed by Sheetal Nandi
parent cd4561ee0e
commit 2b2aaf8b2d

25
types/bull/index.d.ts vendored
View File

@@ -228,11 +228,11 @@ declare namespace Bull {
}
interface JobCounts {
wait: number;
active: number;
completed: number;
failed: number;
delayed: number;
waiting: number;
}
interface JobInformation {
@@ -384,21 +384,27 @@ declare namespace Bull {
/**
* Returns a promise that resolves when the queue is paused.
* The pause is global, meaning that all workers in all queue instances for a given queue will be paused.
* A paused queue will not process new jobs until resumed,
* but current jobs being processed will continue until they are finalized.
*
* A paused queue will not process new jobs until resumed, but current jobs being processed will continue until
* they are finalized. The pause can be either global or local. If global, all workers in all queue instances
* for a given queue will be paused. If local, just this worker will stop processing new jobs after the current
* lock expires. This can be useful to stop a worker from taking new jobs prior to shutting down.
*
* Pausing a queue that is already paused does nothing.
*/
pause(): Promise<void>;
pause(isLocal?: boolean): Promise<void>;
/**
* Returns a promise that resolves when the queue is resumed after being paused.
* The resume is global, meaning that all workers in all queue instances for a given queue will be resumed.
*
* The resume can be either local or global. If global, all workers in all queue instances for a given queue
* will be resumed. If local, only this worker will be resumed. Note that resuming a queue globally will not
* resume workers that have been paused locally; for those, resume(true) must be called directly on their
* instances.
*
* Resuming a queue that is not paused does nothing.
*/
resume(): Promise<void>;
resume(isLocal?: boolean): Promise<void>;
/**
* Returns a promise that returns the number of jobs in the queue, waiting or paused.
@@ -445,6 +451,11 @@ declare namespace Bull {
*/
getFailed(start?: number, end?: number): Promise<Job[]>;
/**
* Returns a promise that will return an array with the waiting jobs between start and end.
*/
getWaiting(start?: number, end?: number): Promise<Job[]>;
/**
* Returns JobInformation of repeatable jobs (ordered descending). Provide a start and/or an end
* index to limit the number of results. Start defaults to 0, end to -1 and asc to false.