@hastehaul/common 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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);
|