mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
fix(bull): adds Queue.process overloads
This commit is contained in:
Vendored
+59
@@ -265,6 +265,24 @@ declare namespace Bull {
|
||||
*/
|
||||
process(callback: (job: Job, done: DoneCallback) => void): void;
|
||||
|
||||
/**
|
||||
* Defines a processing function for the jobs placed into a given Queue.
|
||||
*
|
||||
* The handlerPath defines the path to the job callback.
|
||||
* Using a handlerPath has several advantages:
|
||||
* - The process is sandboxed so if it crashes it does not affect the worker.
|
||||
* - You can run blocking code without affecting the queue (jobs will not stall).
|
||||
* - Much better utilization of multi-core CPUs.
|
||||
* - Less connections to redis.
|
||||
*
|
||||
* It is passed an instance of the job as first argument.
|
||||
*
|
||||
* A promise must be returned to signal job completion.
|
||||
* If the promise is rejected, the error will be passed as a second argument to the "failed" event.
|
||||
* If it is resolved, its value will be the "completed" event's second argument.
|
||||
*/
|
||||
process(handlerPath: string): void;
|
||||
|
||||
/**
|
||||
* Defines a processing function for the jobs placed into a given Queue.
|
||||
*
|
||||
@@ -291,6 +309,26 @@ declare namespace Bull {
|
||||
*/
|
||||
process(concurrency: number, callback: (job: Job) => void): Promise<any>;
|
||||
|
||||
/**
|
||||
* Defines a processing function for the jobs placed into a given Queue.
|
||||
*
|
||||
* The handlerPath defines the path to the job callback.
|
||||
* Using a handlerPath has several advantages:
|
||||
* - The process is sandboxed so if it crashes it does not affect the worker.
|
||||
* - You can run blocking code without affecting the queue (jobs will not stall).
|
||||
* - Much better utilization of multi-core CPUs.
|
||||
* - Less connections to redis.
|
||||
*
|
||||
* It is passed an instance of the job as first argument.
|
||||
*
|
||||
* A promise must be returned to signal job completion.
|
||||
* If the promise is rejected, the error will be passed as a second argument to the "failed" event.
|
||||
* If it is resolved, its value will be the "completed" event's second argument.
|
||||
*
|
||||
* @param concurrency Bull will then call you handler in parallel respecting this max number.
|
||||
*/
|
||||
process(concurrency: number, handlerPath: string): void;
|
||||
|
||||
/**
|
||||
* Defines a processing function for the jobs placed into a given Queue.
|
||||
*
|
||||
@@ -337,6 +375,27 @@ declare namespace Bull {
|
||||
// tslint:disable-next-line:unified-signatures
|
||||
process(name: string, callback: (job: Job, done: DoneCallback) => void): void;
|
||||
|
||||
/**
|
||||
* Defines a processing function for the jobs placed into a given Queue.
|
||||
*
|
||||
* The handlerPath defines the path to the job callback.
|
||||
* Using a handlerPath has several advantages:
|
||||
* - The process is sandboxed so if it crashes it does not affect the worker.
|
||||
* - You can run blocking code without affecting the queue (jobs will not stall).
|
||||
* - Much better utilization of multi-core CPUs.
|
||||
* - Less connections to redis.
|
||||
*
|
||||
* It is passed an instance of the job as first argument.
|
||||
*
|
||||
* A promise must be returned to signal job completion.
|
||||
* If the promise is rejected, the error will be passed as a second argument to the "failed" event.
|
||||
* If it is resolved, its value will be the "completed" event's second argument.
|
||||
*
|
||||
* @param name Bull will only call the handler if the job name matches
|
||||
* @param concurrency Bull will then call you handler in parallel respecting this max number.
|
||||
*/
|
||||
process(name: string, concurrency: number, handlerPath: string): void;
|
||||
|
||||
/**
|
||||
* Defines a named processing function for the jobs placed into a given Queue.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user