@imqueue/core 2.0.16 → 2.0.18
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.
- package/package.json +2 -2
- package/src/IMessageQueue.d.ts +11 -1
- package/src/RedisQueue.js +6 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imqueue/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.18",
|
|
4
4
|
"description": "Simple JSON-based messaging queue for inter service communication",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"message-queue",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"author": "imqueue.com <support@imqueue.com> (https://imqueue.com)",
|
|
39
39
|
"license": "GPL-3.0-only",
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"ioredis": "^5.
|
|
41
|
+
"ioredis": "^5.8.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@eslint/js": "^9.33.0",
|
package/src/IMessageQueue.d.ts
CHANGED
|
@@ -244,11 +244,21 @@ export interface IMQOptions extends Partial<IMessageQueueConnection> {
|
|
|
244
244
|
*/
|
|
245
245
|
clusterManagers?: ClusterManager[];
|
|
246
246
|
/**
|
|
247
|
-
* Enables/disables verbose logging
|
|
247
|
+
* Enables/disables verbose logging
|
|
248
248
|
*
|
|
249
|
+
* @default false
|
|
249
250
|
* @type {boolean}
|
|
250
251
|
*/
|
|
251
252
|
verbose?: boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Enables/disables extended verbose logging. The output may contain
|
|
255
|
+
* sensitive information, so use it with caution. Does not work if a verbose
|
|
256
|
+
* option is disabled.
|
|
257
|
+
*
|
|
258
|
+
* @default false
|
|
259
|
+
* @type {boolean}
|
|
260
|
+
*/
|
|
261
|
+
verboseExtended?: boolean;
|
|
252
262
|
}
|
|
253
263
|
export interface EventMap {
|
|
254
264
|
message: [data: any, id: string, from: string];
|
package/src/RedisQueue.js
CHANGED
|
@@ -218,12 +218,12 @@ class RedisQueue extends events_1.EventEmitter {
|
|
|
218
218
|
if (this.subscription) {
|
|
219
219
|
this.verbose('Initialize unsubscribing...');
|
|
220
220
|
if (this.subscriptionName) {
|
|
221
|
-
|
|
221
|
+
this.subscription.unsubscribe(`${this.options.prefix}:${this.subscriptionName}`);
|
|
222
222
|
this.verbose(`Unsubscribed from ${this.subscriptionName} channel`);
|
|
223
223
|
}
|
|
224
224
|
this.subscription.removeAllListeners();
|
|
225
225
|
this.subscription.disconnect(false);
|
|
226
|
-
|
|
226
|
+
this.subscription.quit();
|
|
227
227
|
}
|
|
228
228
|
this.subscriptionName = undefined;
|
|
229
229
|
this.subscription = undefined;
|
|
@@ -338,7 +338,7 @@ class RedisQueue extends events_1.EventEmitter {
|
|
|
338
338
|
}
|
|
339
339
|
};
|
|
340
340
|
if (delay) {
|
|
341
|
-
|
|
341
|
+
this.writer.zadd(`${key}:delayed`, Date.now() + delay, packet, (err) => {
|
|
342
342
|
// istanbul ignore next
|
|
343
343
|
if (err) {
|
|
344
344
|
cb(err, 'ZADD');
|
|
@@ -354,7 +354,7 @@ class RedisQueue extends events_1.EventEmitter {
|
|
|
354
354
|
});
|
|
355
355
|
}
|
|
356
356
|
else {
|
|
357
|
-
|
|
357
|
+
this.writer.lpush(key, packet, (err) => {
|
|
358
358
|
// istanbul ignore next
|
|
359
359
|
if (err) {
|
|
360
360
|
cb(err, 'LPUSH');
|
|
@@ -374,7 +374,7 @@ class RedisQueue extends events_1.EventEmitter {
|
|
|
374
374
|
if (this.reader) {
|
|
375
375
|
this.verbose('Destroying reader...');
|
|
376
376
|
this.reader.removeAllListeners();
|
|
377
|
-
|
|
377
|
+
this.reader.quit();
|
|
378
378
|
this.reader.disconnect(false);
|
|
379
379
|
delete this.reader;
|
|
380
380
|
}
|
|
@@ -816,7 +816,7 @@ class RedisQueue extends events_1.EventEmitter {
|
|
|
816
816
|
*/
|
|
817
817
|
async onWatchMessage(...args) {
|
|
818
818
|
try {
|
|
819
|
-
const key = (
|
|
819
|
+
const key = (args.pop() || '').split(':');
|
|
820
820
|
if (key.pop() !== 'ttl') {
|
|
821
821
|
return;
|
|
822
822
|
}
|