mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-02 00:00:04 +00:00
Merge pull request #23806 from alexsasharegan/master
fix(bull): adds `Queue.process` overloads
This commit is contained in:
32
types/bull/index.d.ts
vendored
32
types/bull/index.d.ts
vendored
@@ -273,18 +273,30 @@ declare namespace Bull {
|
||||
*
|
||||
* The callback is called everytime a job is placed in the queue.
|
||||
* It is passed an instance of the job as first argument.
|
||||
* The callback can also be defined as the string path to a module
|
||||
* exporting the callback function. Using a path 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.
|
||||
*
|
||||
* 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(callback: (job: Job) => void): Promise<any>;
|
||||
process(callback: ((job: Job) => void) | string): Promise<any>;
|
||||
|
||||
/**
|
||||
* Defines a processing function for the jobs placed into a given Queue.
|
||||
*
|
||||
* The callback is called everytime a job is placed in the queue.
|
||||
* It is passed an instance of the job as first argument.
|
||||
* The callback can also be defined as the string path to a module
|
||||
* exporting the callback function. Using a path 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.
|
||||
*
|
||||
* 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.
|
||||
@@ -292,7 +304,7 @@ declare namespace Bull {
|
||||
*
|
||||
* @param concurrency Bull will then call you handler in parallel respecting this max number.
|
||||
*/
|
||||
process(concurrency: number, callback: (job: Job) => void): Promise<any>;
|
||||
process(concurrency: number, callback: ((job: Job) => void) | string): Promise<any>;
|
||||
|
||||
/**
|
||||
* Defines a processing function for the jobs placed into a given Queue.
|
||||
@@ -314,6 +326,12 @@ declare namespace Bull {
|
||||
*
|
||||
* The callback is called everytime a job is placed in the queue.
|
||||
* It is passed an instance of the job as first argument.
|
||||
* The callback can also be defined as the string path to a module
|
||||
* exporting the callback function. Using a path 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.
|
||||
*
|
||||
* 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.
|
||||
@@ -322,7 +340,7 @@ declare namespace Bull {
|
||||
* @param name Bull will only call the handler if the job name matches
|
||||
*/
|
||||
// tslint:disable-next-line:unified-signatures
|
||||
process(name: string, callback: (job: Job) => void): Promise<any>;
|
||||
process(name: string, callback: ((job: Job) => void) | string): Promise<any>;
|
||||
|
||||
/**
|
||||
* Defines a processing function for the jobs placed into a given Queue.
|
||||
@@ -345,6 +363,12 @@ declare namespace Bull {
|
||||
*
|
||||
* The callback is called everytime a job is placed in the queue.
|
||||
* It is passed an instance of the job as first argument.
|
||||
* The callback can also be defined as the string path to a module
|
||||
* exporting the callback function. Using a path 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.
|
||||
*
|
||||
* 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.
|
||||
@@ -353,7 +377,7 @@ declare namespace Bull {
|
||||
* @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, callback: (job: Job) => void): Promise<any>;
|
||||
process(name: string, concurrency: number, callback: ((job: Job) => void) | string): Promise<any>;
|
||||
|
||||
/**
|
||||
* Defines a processing function for the jobs placed into a given Queue.
|
||||
|
||||
Reference in New Issue
Block a user