@hastehaul/common 2.1.0 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,7 @@ export declare abstract class AbstractJobQueue {
10
10
  *
11
11
  * @param {string} queueName - The name of the job queue.
12
12
  */
13
- constructor(queueName: string);
13
+ constructor(queueName: string, useReplicas?: boolean);
14
14
  /**
15
15
  * Abstract method to add jobs to the job queue.
16
16
  *
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AbstractJobQueue = void 0;
4
4
  const bullmq_1 = require("bullmq");
5
- // import { redisWrapper } from '../../../connections-wrappers/redis-connection-wrapper';
5
+ const redis_connection_wrapper_1 = require("../../../connections-wrappers/redis-connection-wrapper");
6
6
  const redis_wrapper_1 = require("../../../connections-wrappers/redis-wrapper");
7
7
  /**
8
8
  * Abstract class representing a Job Queue.
@@ -13,9 +13,9 @@ class AbstractJobQueue {
13
13
  *
14
14
  * @param {string} queueName - The name of the job queue.
15
15
  */
16
- constructor(queueName) {
16
+ constructor(queueName, useReplicas = true) {
17
17
  // Initialize the job queue with the provided name and a Redis connection from the redisWrapper.
18
- this.que = new bullmq_1.Queue(queueName, { connection: redis_wrapper_1.rWrapper.masterClient, prefix: '{BULLMQ}' });
18
+ this.que = new bullmq_1.Queue(queueName, { connection: useReplicas ? redis_wrapper_1.rWrapper.masterClient : redis_connection_wrapper_1.redisWrapper.client, prefix: '{BULLMQ}' });
19
19
  }
20
20
  }
21
21
  exports.AbstractJobQueue = AbstractJobQueue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hastehaul/common",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",