@imqueue/core 2.0.25 → 3.0.0

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 (49) hide show
  1. package/.oxfmtrc.json +9 -0
  2. package/.oxlintrc.json +20 -0
  3. package/README.md +73 -63
  4. package/debug_getter.d.ts +1 -9
  5. package/index.d.ts +0 -1
  6. package/index.js +8 -9
  7. package/package.json +20 -67
  8. package/scripts/strip-comment-coverage.mjs +397 -0
  9. package/src/ClusterManager.d.ts +12 -3
  10. package/src/ClusterManager.js +21 -10
  11. package/src/ClusteredRedisQueue.d.ts +46 -14
  12. package/src/ClusteredRedisQueue.js +196 -169
  13. package/src/IMessageQueue.d.ts +89 -96
  14. package/src/IMessageQueue.js +2 -2
  15. package/src/RedisQueue.d.ts +193 -97
  16. package/src/RedisQueue.js +1328 -1070
  17. package/src/UDPClusterManager.d.ts +110 -26
  18. package/src/UDPClusterManager.js +227 -70
  19. package/src/UDPWorker.d.ts +53 -1
  20. package/src/UDPWorker.js +87 -46
  21. package/src/{promisify.d.ts → helpers/buildOptions.d.ts} +8 -15
  22. package/src/helpers/buildOptions.js +39 -0
  23. package/src/{copyEventEmitter.d.ts → helpers/copyEventEmitter.d.ts} +1 -1
  24. package/src/{copyEventEmitter.js → helpers/copyEventEmitter.js} +3 -4
  25. package/src/helpers/envInt.d.ts +32 -0
  26. package/src/helpers/envInt.js +39 -0
  27. package/src/helpers/escapeRegExp.d.ts +30 -0
  28. package/src/helpers/escapeRegExp.js +36 -0
  29. package/src/helpers/index.d.ts +31 -0
  30. package/src/helpers/index.js +48 -0
  31. package/src/helpers/pack.d.ts +7 -0
  32. package/src/helpers/pack.js +37 -0
  33. package/src/helpers/randomInt.d.ts +31 -0
  34. package/src/helpers/randomInt.js +37 -0
  35. package/src/helpers/sha1.d.ts +7 -0
  36. package/src/helpers/sha1.js +39 -0
  37. package/src/helpers/unpack.d.ts +7 -0
  38. package/src/helpers/unpack.js +37 -0
  39. package/src/index.d.ts +1 -14
  40. package/src/index.js +1 -19
  41. package/src/profile.d.ts +28 -38
  42. package/src/profile.js +100 -95
  43. package/src/redis.d.ts +1 -1
  44. package/src/redis.js +4 -2
  45. package/typedoc.json +19 -0
  46. package/eslint.config.mjs +0 -98
  47. package/src/promisify.js +0 -106
  48. package/src/uuid.d.ts +0 -6
  49. package/src/uuid.js +0 -65
@@ -1,11 +1,4 @@
1
1
  "use strict";
2
- var __asyncValues = (this && this.__asyncValues) || function (o) {
3
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
4
- var m = o[Symbol.asyncIterator], i;
5
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
6
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
7
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
8
- };
9
2
  Object.defineProperty(exports, "__esModule", { value: true });
10
3
  exports.ClusteredRedisQueue = void 0;
11
4
  /*!
@@ -31,72 +24,112 @@ exports.ClusteredRedisQueue = void 0;
31
24
  * purchase a proprietary commercial license. Please contact us at
32
25
  * <support@imqueue.com> to get commercial licensing options.
33
26
  */
34
- const events_1 = require("events");
27
+ const node_events_1 = require("node:events");
28
+ const helpers_1 = require("./helpers");
35
29
  const _1 = require(".");
30
+ /**
31
+ * Time (ms) send() waits for the first cluster server to become available
32
+ * before rejecting, when the cluster is still empty. Configurable via the
33
+ * IMQ_SEND_INIT_TIMEOUT environment variable, defaults to 30,000.
34
+ */
35
+ const SEND_INIT_TIMEOUT = +(process.env.IMQ_SEND_INIT_TIMEOUT || 0) || 30000;
36
36
  /**
37
37
  * Class ClusteredRedisQueue
38
- * Implements the possibility to scale queues horizontally between several
38
+ Implements the possibility to scale queues horizontally between several
39
39
  * redis instances.
40
40
  */
41
41
  class ClusteredRedisQueue {
42
+ name;
43
+ /**
44
+ * Logger instance associated with this queue instance
45
+ *
46
+ * @type {ILogger}
47
+ */
48
+ logger;
49
+ /**
50
+ * RedisQueue instances collection
51
+ *
52
+ * @type {RedisQueue[]}
53
+ */
54
+ imqs = [];
55
+ /**
56
+ * Options associated with this queue instance
57
+ *
58
+ * @type {IMQOptions}
59
+ */
60
+ options;
61
+ /**
62
+ * Part of options without cluster definitions - which are generic for
63
+ * RedisQueue instances
64
+ *
65
+ * @type {IMQOptions}
66
+ */
67
+ mqOptions;
68
+ /**
69
+ * Cluster servers option definitions
70
+ *
71
+ * @type {IMessageQueueConnection[]}
72
+ */
73
+ servers = [];
74
+ /**
75
+ * Current queue index (round-robin)
76
+ *
77
+ * @type {number}
78
+ */
79
+ currentQueue = 0;
80
+ /**
81
+ * Time (ms) send() waits for the first server when the cluster is empty
82
+ */
83
+ sendInitTimeout = SEND_INIT_TIMEOUT;
84
+ /**
85
+ * Total length of RedisQueue instances
86
+ *
87
+ * @type {number}
88
+ */
89
+ imqLength = 0;
90
+ /**
91
+ * Template EventEmitter instance used to replicate queue EventEmitters when
92
+ * dynamically modifying the cluster
93
+ * @type {EventEmitter}
94
+ * @private
95
+ */
96
+ templateEmitter;
97
+ /**
98
+ * Cluster EventEmitter instance used to notify about changes of
99
+ * cluster servers
100
+ * @type {EventEmitter}
101
+ * @private
102
+ */
103
+ clusterEmitter;
104
+ state = {
105
+ started: false,
106
+ subscription: null,
107
+ };
108
+ initializedClusters = [];
42
109
  /**
43
110
  * Class constructor
44
111
  *
45
- * @constructor
46
112
  * @param {string} name
47
113
  * @param {Partial<IMQOptions>} options
48
- * @param {IMQMode} [mode]
114
+ * @param {IMQMode} [_mode]
49
115
  */
50
- constructor(name, options, mode = _1.IMQMode.BOTH) {
51
- var _a, _b;
116
+ constructor(name, options, _mode = _1.IMQMode.BOTH) {
52
117
  this.name = name;
53
- /**
54
- * RedisQueue instances collection
55
- *
56
- * @type {RedisQueue[]}
57
- */
58
- this.imqs = [];
59
- /**
60
- * Cluster servers option definitions
61
- *
62
- * @type {IMessageQueueConnection[]}
63
- */
64
- // tslint:disable-next-line:completed-docs
65
- this.servers = [];
66
- /**
67
- * Current queue index (round-robin)
68
- *
69
- * @type {number}
70
- */
71
- this.currentQueue = 0;
72
- // noinspection TypeScriptFieldCanBeMadeReadonly
73
- /**
74
- * Total length of RedisQueue instances
75
- *
76
- * @type {number}
77
- */
78
- this.imqLength = 0;
79
- this.state = {
80
- started: false,
81
- subscription: null,
82
- };
83
- this.initializedClusters = [];
84
- this.templateEmitter = new events_1.EventEmitter();
85
- this.clusterEmitter = new events_1.EventEmitter();
86
- this.options = (0, _1.buildOptions)(_1.DEFAULT_IMQ_OPTIONS, options);
87
- // istanbul ignore next
118
+ this.templateEmitter = new node_events_1.EventEmitter();
119
+ this.clusterEmitter = new node_events_1.EventEmitter();
120
+ this.options = (0, helpers_1.buildOptions)(_1.DEFAULT_IMQ_OPTIONS, options);
88
121
  this.logger = this.options.logger || console;
89
- if (!this.options.cluster && !((_a = this.options.clusterManagers) === null || _a === void 0 ? void 0 : _a.length)) {
90
- throw new TypeError('ClusteredRedisQueue: cluster ' +
91
- 'configuration is missing!');
122
+ if (!this.options.cluster && !this.options.clusterManagers?.length) {
123
+ throw new TypeError('ClusteredRedisQueue: cluster ' + 'configuration is missing!');
92
124
  }
93
- this.mqOptions = Object.assign({}, this.options);
94
- const cluster = [...this.mqOptions.cluster || []];
125
+ this.mqOptions = { ...this.options };
126
+ const cluster = [...(this.mqOptions.cluster || [])];
95
127
  delete this.mqOptions.cluster;
96
128
  for (const server of cluster) {
97
129
  this.addServerWithQueueInitializing(server, false);
98
130
  }
99
- if ((_b = this.options.clusterManagers) === null || _b === void 0 ? void 0 : _b.length) {
131
+ if (this.options.clusterManagers?.length) {
132
+ this.verbose('Initializing cluster managers...');
100
133
  for (const manager of this.options.clusterManagers) {
101
134
  this.initializedClusters.push(manager.init({
102
135
  add: this.addServer.bind(this),
@@ -127,30 +160,66 @@ class ClusteredRedisQueue {
127
160
  return await this.batch('stop', 'Stopping clustered redis message queue...');
128
161
  }
129
162
  /**
130
- * Sends a message to given queue name with the given data.
163
+ * Sends a message to a given queue name with the given data.
131
164
  * Supposed to be an async function.
132
165
  *
133
- * @param {string} toQueue - queue name to which message should be sent to
166
+ * @param {string} toQueue - queue name to which a message should be sent to
134
167
  * @param {JsonObject} message - message data
135
168
  * @param {number} [delay] - if specified, a message will be handled in the
136
- * target queue after a specified period of time in milliseconds.
169
+ target queue after a specified period of time in milliseconds.
137
170
  * @param {(err: Error) => void} [errorHandler] - callback called only when
138
- * internal error occurs during message send execution.
171
+ internal error occurs during message send execution.
139
172
  * @returns {Promise<string>} - message identifier
140
173
  */
141
174
  async send(toQueue, message, delay, errorHandler) {
142
175
  if (!this.imqLength) {
143
- return await new Promise(resolve => this.clusterEmitter.once('initialized', async ({ imq }) => {
144
- resolve(await imq.send(toQueue, message, delay, errorHandler));
145
- }));
176
+ return this.sendWhenInitialized(toQueue, message, delay, errorHandler);
146
177
  }
147
- if (this.currentQueue >= this.imqLength) {
148
- this.currentQueue = 0;
178
+ const imq = this.selectQueue();
179
+ return imq.send(toQueue, message, delay, errorHandler);
180
+ }
181
+ /**
182
+ * Picks the next queue for a round-robin send, preferring an instance
183
+ * whose redis connection is currently ready so messages are not routed
184
+ * to a host that is known to be down. Falls back to the plain
185
+ * round-robin pick when no instance reports are ready.
186
+ *
187
+ * @returns {RedisQueue}
188
+ */
189
+ selectQueue() {
190
+ const count = this.imqLength;
191
+ const start = this.currentQueue % count;
192
+ for (let offset = 0; offset < count; offset++) {
193
+ const index = (start + offset) % count;
194
+ const candidate = this.imqs[index];
195
+ if (candidate.available) {
196
+ this.currentQueue = index + 1;
197
+ return candidate;
198
+ }
149
199
  }
150
- const imq = this.imqs[this.currentQueue];
151
- const id = await imq.send(toQueue, message, delay, errorHandler);
152
- this.currentQueue++;
153
- return id;
200
+ this.currentQueue = start + 1;
201
+ return this.imqs[start];
202
+ }
203
+ /**
204
+ * Sends a message once the first cluster server becomes available.
205
+ * Rejects (rather than hanging forever) if none appears within the
206
+ * configured timeout and propagates any sent failure.
207
+ *
208
+ * @returns {Promise<string>}
209
+ */
210
+ sendWhenInitialized(toQueue, message, delay, errorHandler) {
211
+ return new Promise((resolve, reject) => {
212
+ const onInitialized = ({ imq }) => {
213
+ clearTimeout(timer);
214
+ imq.send(toQueue, message, delay, errorHandler).then(resolve, reject);
215
+ };
216
+ const timer = setTimeout(() => {
217
+ this.clusterEmitter.removeListener('initialized', onInitialized);
218
+ reject(new Error('ClusteredRedisQueue: no cluster server became ' +
219
+ 'available to send the message'));
220
+ }, this.sendInitTimeout);
221
+ this.clusterEmitter.once('initialized', onInitialized);
222
+ });
154
223
  }
155
224
  /**
156
225
  * Safely destroys the current queue, unregistered all set event
@@ -160,44 +229,17 @@ class ClusteredRedisQueue {
160
229
  * @returns {Promise<void>}
161
230
  */
162
231
  async destroy() {
163
- var _a, e_1, _b, _c, _d, e_2, _e, _f;
164
- var _g;
165
232
  this.state.started = false;
166
233
  await this.batch('destroy', 'Destroying clustered redis message queue...');
167
- if (!((_g = this.options.clusterManagers) === null || _g === void 0 ? void 0 : _g.length)) {
234
+ if (!this.options.clusterManagers?.length) {
168
235
  return;
169
236
  }
170
- try {
171
- for (var _h = true, _j = __asyncValues(this.options.clusterManagers), _k; _k = await _j.next(), _a = _k.done, !_a; _h = true) {
172
- _c = _k.value;
173
- _h = false;
174
- const manager = _c;
175
- try {
176
- for (var _l = true, _m = (e_2 = void 0, __asyncValues(this.initializedClusters)), _o; _o = await _m.next(), _d = _o.done, !_d; _l = true) {
177
- _f = _o.value;
178
- _l = false;
179
- const cluster = _f;
180
- await manager.remove(cluster);
181
- }
182
- }
183
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
184
- finally {
185
- try {
186
- if (!_l && !_d && (_e = _m.return)) await _e.call(_m);
187
- }
188
- finally { if (e_2) throw e_2.error; }
189
- }
237
+ for (const manager of this.options.clusterManagers) {
238
+ for (const cluster of this.initializedClusters) {
239
+ await manager.remove(cluster);
190
240
  }
191
241
  }
192
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
193
- finally {
194
- try {
195
- if (!_h && !_a && (_b = _j.return)) await _b.call(_j);
196
- }
197
- finally { if (e_1) throw e_1.error; }
198
- }
199
242
  }
200
- // noinspection JSUnusedGlobalSymbols
201
243
  /**
202
244
  * Clears queue data in queue host application.
203
245
  * Supposed to be an async function.
@@ -215,125 +257,108 @@ class ClusteredRedisQueue {
215
257
  const lengths = await Promise.all(promises);
216
258
  return lengths.reduce((total, length) => total + length, 0);
217
259
  }
260
+ verbose(message) {
261
+ if (this.options.verbose) {
262
+ this.logger.info(`[IMQ-CORE][ClusteredRedisQueue][${this.name}]: ${message}`);
263
+ }
264
+ }
218
265
  /**
219
266
  * Batch imq action processing on all registered imqs at once
220
267
  *
221
- * @access private
222
268
  * @param {string} action
223
269
  * @param {string} message
224
- * @return {Promise<this>}
270
+ * @returns {Promise<this>}
225
271
  */
226
272
  async batch(action, message) {
227
- this.logger.log(message);
273
+ this.logger.info(message);
228
274
  const promises = [];
229
275
  for (const imq of this.imqs) {
230
- promises.push(imq[action]());
276
+ const run = imq[action];
277
+ promises.push(run.call(imq));
231
278
  }
232
279
  await Promise.all(promises);
233
280
  return this;
234
281
  }
235
- /* tslint:disable */
236
282
  // EventEmitter interface
237
- // istanbul ignore next
238
- on(...args) {
283
+ /**
284
+ * Applies the named EventEmitter method to every underlying emitter,
285
+ * forwarding the call across the whole cluster. Dispatch is reflective
286
+ * (method chosen by name), so a single contained cast bridges the dynamic
287
+ * call while the public method signatures below stay fully typed.
288
+ *
289
+ * @template K - EventEmitter method name
290
+ * @param {K} method - name of the EventEmitter method to invoke
291
+ * @param {any[]} args - arguments to pass to the method
292
+ * @returns {unknown[]} - results from each emitter call
293
+ */
294
+ applyToEmitters(method, args) {
295
+ const results = [];
239
296
  for (const imq of this.eventEmitters()) {
240
- imq.on.apply(imq, args);
297
+ const fn = imq[method];
298
+ results.push(fn.apply(imq, args));
241
299
  }
300
+ return results;
301
+ }
302
+ on(...args) {
303
+ this.applyToEmitters('on', args);
242
304
  return this;
243
305
  }
244
- // istanbul ignore next
245
- // noinspection JSUnusedGlobalSymbols
246
306
  off(...args) {
247
- for (const imq of this.eventEmitters()) {
248
- imq.off.apply(imq, args);
249
- }
307
+ this.applyToEmitters('off', args);
250
308
  return this;
251
309
  }
252
- // istanbul ignore next
253
310
  once(...args) {
254
- for (const imq of this.eventEmitters()) {
255
- imq.once.apply(imq, args);
256
- }
311
+ this.applyToEmitters('once', args);
257
312
  return this;
258
313
  }
259
- // istanbul ignore next
260
314
  addListener(...args) {
261
- for (const imq of this.eventEmitters()) {
262
- imq.addListener.apply(imq, args);
263
- }
315
+ this.applyToEmitters('addListener', args);
264
316
  return this;
265
317
  }
266
- // istanbul ignore next
267
318
  removeListener(...args) {
268
- for (const imq of this.eventEmitters()) {
269
- imq.removeListener.apply(imq, args);
270
- }
319
+ this.applyToEmitters('removeListener', args);
271
320
  return this;
272
321
  }
273
- // istanbul ignore next
274
322
  removeAllListeners(...args) {
275
- for (const imq of this.eventEmitters()) {
276
- imq.removeAllListeners.apply(imq, args);
277
- }
323
+ this.applyToEmitters('removeAllListeners', args);
278
324
  return this;
279
325
  }
280
- // istanbul ignore next
281
326
  prependListener(...args) {
282
- for (const imq of this.eventEmitters()) {
283
- imq.prependListener.apply(imq, args);
284
- }
327
+ this.applyToEmitters('prependListener', args);
285
328
  return this;
286
329
  }
287
- // istanbul ignore next
288
330
  prependOnceListener(...args) {
289
- for (const imq of this.eventEmitters()) {
290
- imq.prependOnceListener.apply(imq, args);
291
- }
331
+ this.applyToEmitters('prependOnceListener', args);
292
332
  return this;
293
333
  }
294
- // istanbul ignore next
295
334
  setMaxListeners(...args) {
296
- for (const imq of this.eventEmitters()) {
297
- imq.setMaxListeners.apply(imq, args);
298
- }
335
+ this.applyToEmitters('setMaxListeners', args);
299
336
  return this;
300
337
  }
301
- // istanbul ignore next
338
+ // Aggregates listeners across every underlying emitter, so the result is
339
+ // an untyped union rather than Node's per-emitter conditional listener type.
302
340
  listeners(...args) {
303
- let listeners = [];
304
- for (const imq of this.eventEmitters()) {
305
- listeners = listeners.concat(imq.listeners.apply(imq, args));
306
- }
307
- return listeners;
341
+ return this.applyToEmitters('listeners', args).flat();
308
342
  }
309
- // istanbul ignore next
310
343
  rawListeners(...args) {
311
- let rawListeners = [];
312
- for (const imq of this.eventEmitters()) {
313
- rawListeners = rawListeners.concat(imq.rawListeners.apply(imq, args));
314
- }
315
- return rawListeners;
344
+ return this.applyToEmitters('rawListeners', args).flat();
316
345
  }
317
- // istanbul ignore next
318
346
  getMaxListeners() {
319
347
  return this.templateEmitter.getMaxListeners();
320
348
  }
321
- // istanbul ignore next
322
349
  emit(...args) {
323
- for (const imq of this.eventEmitters()) {
324
- imq.emit.apply(imq, args);
325
- }
350
+ this.applyToEmitters('emit', args);
326
351
  return true;
327
352
  }
328
- // istanbul ignore next
329
- eventNames(...args) {
330
- return this.templateEmitter.eventNames.apply(this.imqs[0], args);
353
+ eventNames() {
354
+ const source = this.imqs[0] || this.templateEmitter;
355
+ return source.eventNames();
331
356
  }
332
- // istanbul ignore next
333
357
  listenerCount(...args) {
334
- return this.templateEmitter.listenerCount.apply(this.imqs[0], args);
358
+ const source = this.imqs[0] || this.templateEmitter;
359
+ const fn = source.listenerCount;
360
+ return fn.apply(source, args);
335
361
  }
336
- // istanbul ignore next
337
362
  async publish(data, toName) {
338
363
  const promises = [];
339
364
  for (const imq of this.imqs) {
@@ -341,7 +366,6 @@ class ClusteredRedisQueue {
341
366
  }
342
367
  await Promise.all(promises);
343
368
  }
344
- // istanbul ignore next
345
369
  async subscribe(channel, handler) {
346
370
  this.state.subscription = { channel, handler };
347
371
  const promises = [];
@@ -350,7 +374,6 @@ class ClusteredRedisQueue {
350
374
  }
351
375
  await Promise.all(promises);
352
376
  }
353
- // istanbul ignore next
354
377
  async unsubscribe() {
355
378
  this.state.subscription = null;
356
379
  const promises = [];
@@ -366,6 +389,7 @@ class ClusteredRedisQueue {
366
389
  * @returns {void}
367
390
  */
368
391
  addServer(server) {
392
+ this.verbose(`Adding new server: ${JSON.stringify(server)}`);
369
393
  return this.addServerWithQueueInitializing(server, true);
370
394
  }
371
395
  /**
@@ -375,6 +399,7 @@ class ClusteredRedisQueue {
375
399
  * @returns {void}
376
400
  */
377
401
  removeServer(server) {
402
+ this.verbose(`Removing the server: ${JSON.stringify(server)}`);
378
403
  const remove = this.findServer(server);
379
404
  if (!remove) {
380
405
  return;
@@ -382,7 +407,9 @@ class ClusteredRedisQueue {
382
407
  const imqToRemove = remove.imq;
383
408
  if (imqToRemove) {
384
409
  this.imqs = this.imqs.filter(imq => imqToRemove.redisKey !== imq.redisKey);
385
- imqToRemove.destroy().catch();
410
+ imqToRemove
411
+ .destroy()
412
+ .catch((err) => this.verbose(`Error destroying removed server: ${err}`));
386
413
  }
387
414
  this.imqLength = this.imqs.length;
388
415
  this.servers = this.servers.filter(existing => !ClusteredRedisQueue.matchServers(existing, server));
@@ -401,8 +428,9 @@ class ClusteredRedisQueue {
401
428
  host: server.host,
402
429
  port: server.port,
403
430
  };
404
- const opts = Object.assign(Object.assign({}, this.mqOptions), newServer);
431
+ const opts = { ...this.mqOptions, ...newServer };
405
432
  const imq = new _1.RedisQueue(this.name, opts);
433
+ (0, helpers_1.copyEventEmitter)(this.templateEmitter, imq);
406
434
  if (initializeQueue) {
407
435
  this.initializeQueue(imq).then(() => {
408
436
  this.clusterEmitter.emit('initialized', {
@@ -422,7 +450,7 @@ class ClusteredRedisQueue {
422
450
  return [...this.imqs, this.templateEmitter];
423
451
  }
424
452
  async initializeQueue(imq) {
425
- (0, _1.copyEventEmitter)(this.templateEmitter, imq);
453
+ this.verbose(`Initializing queue with state: ${JSON.stringify(this.state)}`);
426
454
  if (this.state.started) {
427
455
  await imq.start();
428
456
  }
@@ -434,8 +462,7 @@ class ClusteredRedisQueue {
434
462
  return this.servers.find(existing => ClusteredRedisQueue.matchServers(existing, server));
435
463
  }
436
464
  static matchServers(source, target) {
437
- const sameAddress = target.host === source.host
438
- && target.port === source.port;
465
+ const sameAddress = target.host === source.host && target.port === source.port;
439
466
  if (!target.id && !source.id) {
440
467
  return sameAddress;
441
468
  }