@imqueue/core 2.0.19 → 2.0.22
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 +1 -1
- package/src/RedisQueue.js +5 -4
- package/src/redis.d.ts +0 -2
- package/src/redis.js +0 -25
package/package.json
CHANGED
package/src/RedisQueue.js
CHANGED
|
@@ -577,11 +577,12 @@ class RedisQueue extends events_1.EventEmitter {
|
|
|
577
577
|
connectionName: this.getChannelName(context.name + '', options.prefix || '', channel),
|
|
578
578
|
retryStrategy: this.retryStrategy(context),
|
|
579
579
|
autoResubscribe: true,
|
|
580
|
-
enableReadyCheck: true,
|
|
581
580
|
enableOfflineQueue: true,
|
|
582
581
|
autoResendUnfulfilledCommands: true,
|
|
582
|
+
offlineQueue: true,
|
|
583
|
+
maxRetriesPerRequest: null,
|
|
583
584
|
});
|
|
584
|
-
context[channel] =
|
|
585
|
+
context[channel] = redis;
|
|
585
586
|
context[channel].__imq = true;
|
|
586
587
|
for (const event of [
|
|
587
588
|
'wait',
|
|
@@ -614,7 +615,7 @@ class RedisQueue extends events_1.EventEmitter {
|
|
|
614
615
|
return null;
|
|
615
616
|
}
|
|
616
617
|
this.verbose('Redis connection error, retrying...');
|
|
617
|
-
return
|
|
618
|
+
return null;
|
|
618
619
|
};
|
|
619
620
|
}
|
|
620
621
|
/**
|
|
@@ -847,7 +848,7 @@ class RedisQueue extends events_1.EventEmitter {
|
|
|
847
848
|
*/
|
|
848
849
|
// istanbul ignore next
|
|
849
850
|
watch() {
|
|
850
|
-
if (!this.watcher || this.watcher.__ready__) {
|
|
851
|
+
if (!this.writer || !this.watcher || this.watcher.__ready__) {
|
|
851
852
|
return this;
|
|
852
853
|
}
|
|
853
854
|
try {
|
package/src/redis.d.ts
CHANGED
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
* <support@imqueue.com> to get commercial licensing options.
|
|
23
23
|
*/
|
|
24
24
|
import Redis from 'ioredis';
|
|
25
|
-
import { ILogger } from './IMessageQueue';
|
|
26
25
|
/**
|
|
27
26
|
* Extends default Redis type to allow dynamic properties access on it
|
|
28
27
|
*
|
|
@@ -32,6 +31,5 @@ export interface IRedisClient extends Redis {
|
|
|
32
31
|
__ready__?: boolean;
|
|
33
32
|
__imq?: boolean;
|
|
34
33
|
}
|
|
35
|
-
export declare function makeRedisSafe(redis: IRedisClient, logger?: ILogger): IRedisClient;
|
|
36
34
|
export { Redis };
|
|
37
35
|
export default Redis;
|
package/src/redis.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Redis = void 0;
|
|
4
|
-
exports.makeRedisSafe = makeRedisSafe;
|
|
5
4
|
/*!
|
|
6
5
|
* Extends native redis module to be promise-like
|
|
7
6
|
*
|
|
@@ -28,29 +27,5 @@ exports.makeRedisSafe = makeRedisSafe;
|
|
|
28
27
|
/* tslint:disable */
|
|
29
28
|
const ioredis_1 = require("ioredis");
|
|
30
29
|
exports.Redis = ioredis_1.default;
|
|
31
|
-
// istanbul ignore next
|
|
32
|
-
function makeRedisSafe(redis, logger) {
|
|
33
|
-
return new Proxy(redis, {
|
|
34
|
-
get(target, property, receiver) {
|
|
35
|
-
const original = Reflect.get(target, property, receiver);
|
|
36
|
-
if (typeof original === 'function') {
|
|
37
|
-
return async (...args) => {
|
|
38
|
-
try {
|
|
39
|
-
if (target.status !== 'ready') {
|
|
40
|
-
logger === null || logger === void 0 ? void 0 : logger.warn('Redis client is not ready yet, while ', `executing command: "${String(property)}"`);
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
return await original.apply(target, args);
|
|
44
|
-
}
|
|
45
|
-
catch (err) {
|
|
46
|
-
logger === null || logger === void 0 ? void 0 : logger.error(err);
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
return original;
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
30
|
exports.default = ioredis_1.default;
|
|
56
31
|
//# sourceMappingURL=redis.js.map
|