@zintrust/queue-monitor 2.1.8 → 2.1.9

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.
Files changed (2) hide show
  1. package/dist/driver.js +18 -3
  2. package/package.json +1 -1
package/dist/driver.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { Env } from '@zintrust/core/config';
1
2
  import { ErrorFactory } from '@zintrust/core/errors';
2
3
  import { Logger } from '@zintrust/core/logger';
3
4
  import { getBullMQSafeQueueName } from '@zintrust/core/redis';
@@ -46,12 +47,26 @@ async function discoverQueuesFromRedis(redis, inMemoryQueues) {
46
47
  // eslint-disable-next-line max-lines-per-function
47
48
  export const createBullMQDriver = (config) => {
48
49
  const queues = new Map();
49
- const redis = createRedisConnection(config, 3, { subsystem: 'queue-monitor' });
50
+ const requireDirectForScripts = Env.getBool('REDIS_REQUIRE_DIRECT_FOR_SCRIPTS', true) && Env.getBool('USE_REDIS_PROXY', false);
51
+ let redis;
52
+ // TODO remove when proxy convert to rpc
53
+ if (requireDirectForScripts) {
54
+ redis = {
55
+ host: config.host,
56
+ port: config.port,
57
+ db: config.db,
58
+ password: config.password,
59
+ };
60
+ }
61
+ else {
62
+ redis = createRedisConnection(config, 3, {
63
+ subsystem: 'queue-monitor',
64
+ });
65
+ }
50
66
  const getQueue = (name) => {
51
67
  if (!queues.has(name)) {
52
68
  const prefix = getBullMQSafeQueueName();
53
- const connection = createRedisConnection(config, 3, { subsystem: 'queue-monitor' });
54
- const queue = new Queue(name, { prefix, connection: connection });
69
+ const queue = new Queue(name, { prefix, connection: redis });
55
70
  queues.set(name, queue);
56
71
  }
57
72
  const queue = queues.get(name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zintrust/queue-monitor",
3
- "version": "2.1.8",
3
+ "version": "2.1.9",
4
4
  "description": "Queue monitoring package for ZinTrust with BullMQ and Redis.",
5
5
  "private": false,
6
6
  "type": "module",