@hastehaul/common 2.3.0 → 2.4.1
Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@ export declare abstract class AbstractJobQueue {
|
|
12
12
|
*/
|
13
13
|
constructor(queueName: string, useReplicas?: boolean);
|
14
14
|
/**
|
15
|
-
* Abstract method to add jobs to the job queue.
|
15
|
+
* Abstract method to add jobs to the job queue. onpe
|
16
16
|
*
|
17
17
|
* This method should be implemented by subclasses to add specific jobs to the queue.
|
18
18
|
*
|
@@ -9,7 +9,7 @@ export declare abstract class AbstractWorker {
|
|
9
9
|
*
|
10
10
|
* @param {string} queueName - The name of the job queue that this worker will process jobs from.
|
11
11
|
*/
|
12
|
-
constructor(queueName: string, useReplicas?: boolean);
|
12
|
+
constructor(queueName: string, useReplicas?: boolean, opts?: WorkerOptions | undefined);
|
13
13
|
/**
|
14
14
|
* Abstract method to process jobs retrieved from the job queue.
|
15
15
|
*
|
@@ -13,13 +13,9 @@ class AbstractWorker {
|
|
13
13
|
*
|
14
14
|
* @param {string} queueName - The name of the job queue that this worker will process jobs from.
|
15
15
|
*/
|
16
|
-
constructor(queueName, useReplicas = true) {
|
16
|
+
constructor(queueName, useReplicas = true, opts) {
|
17
17
|
// Create a worker instance with the provided queueName and bind the 'process' method to this worker.
|
18
|
-
this.worker = new bullmq_1.Worker(queueName, this.process.bind(this), {
|
19
|
-
connection: useReplicas ? redis_wrapper_1.rWrapper.masterClient : redis_connection_wrapper_1.redisWrapper.client,
|
20
|
-
autorun: false,
|
21
|
-
prefix: '{BULLMQ}',
|
22
|
-
});
|
18
|
+
this.worker = new bullmq_1.Worker(queueName, this.process.bind(this), Object.assign({ connection: useReplicas ? redis_wrapper_1.rWrapper.masterClient : redis_connection_wrapper_1.redisWrapper.client, autorun: false, prefix: '{BULLMQ}' }, opts));
|
23
19
|
// Handle errors that may occur during job processing.
|
24
20
|
this.worker.on("error", (err) => {
|
25
21
|
console.error(`${queueName} Error: `, err);
|