@pioneer-platform/redis-queue 8.11.0 → 8.11.2
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/.turbo/turbo-build.log +1 -2
- package/CHANGELOG.md +12 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +4 -2
- package/package.json +3 -3
- package/src/index.ts +6 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
[0m[2m[35m$[0m [2m[1mtsc[0m
|
|
1
|
+
$ tsc
|
package/CHANGELOG.md
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const log: any;
|
|
2
|
-
declare const subscriber: any, publisher: any, redis: any;
|
|
2
|
+
declare const subscriber: any, publisher: any, redis: any, redisQueue: any;
|
|
3
3
|
declare const QUEUE_INTERVAL_TIME: number;
|
|
4
4
|
declare let QUEUE_NAME: string;
|
|
5
5
|
declare let QUEUE_INFO: any;
|
package/lib/index.js
CHANGED
|
@@ -44,7 +44,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
var log = require('@pioneer-platform/loggerdog')();
|
|
47
|
-
|
|
47
|
+
// IMPORTANT: Use dedicated redisQueue client for blocking operations (brpop)
|
|
48
|
+
// Using the main redis client for brpop blocks ALL operations on that connection
|
|
49
|
+
var _a = require('@pioneer-platform/default-redis'), subscriber = _a.subscriber, publisher = _a.publisher, redis = _a.redis, redisQueue = _a.redisQueue;
|
|
48
50
|
var QUEUE_INTERVAL_TIME = 10;
|
|
49
51
|
var QUEUE_NAME;
|
|
50
52
|
var QUEUE_INFO = {};
|
|
@@ -107,7 +109,7 @@ module.exports = {
|
|
|
107
109
|
if (!WORK_REMOVED[name])
|
|
108
110
|
WORK_REMOVED[name] = 0;
|
|
109
111
|
WORK_REMOVED[name] = WORK_REMOVED[name] + 1;
|
|
110
|
-
return [4 /*yield*/,
|
|
112
|
+
return [4 /*yield*/, redisQueue.brpop(name, QUEUE_INTERVAL_TIME)];
|
|
111
113
|
case 1:
|
|
112
114
|
result = _a.sent();
|
|
113
115
|
if (result && result[1])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pioneer-platform/redis-queue",
|
|
3
|
-
"version": "8.11.
|
|
3
|
+
"version": "8.11.2",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"types": "./lib/main.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
"prepublish": "tsc"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@pioneer-platform/default-redis": "^8.11.
|
|
12
|
+
"@pioneer-platform/default-redis": "^8.11.7",
|
|
13
13
|
"@pioneer-platform/loggerdog": "^8.11.0",
|
|
14
14
|
"@types/node": "^18.15.11",
|
|
15
15
|
"ts-node": "^8.10.2",
|
|
16
16
|
"typescript": "^5.0.4"
|
|
17
17
|
},
|
|
18
18
|
"gitHead": "aeae28273014ab69b42f22abec159c6693a56c40"
|
|
19
|
-
}
|
|
19
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
const log = require('@pioneer-platform/loggerdog')()
|
|
11
|
-
|
|
11
|
+
// IMPORTANT: Use dedicated redisQueue client for blocking operations (brpop)
|
|
12
|
+
// Using the main redis client for brpop blocks ALL operations on that connection
|
|
13
|
+
const { subscriber, publisher, redis, redisQueue } = require('@pioneer-platform/default-redis')
|
|
12
14
|
|
|
13
15
|
const QUEUE_INTERVAL_TIME:number = 10
|
|
14
16
|
let QUEUE_NAME:string
|
|
@@ -49,7 +51,9 @@ module.exports = {
|
|
|
49
51
|
if(!WORK_REMOVED[name]) WORK_REMOVED[name] = 0
|
|
50
52
|
WORK_REMOVED[name] = WORK_REMOVED[name] + 1
|
|
51
53
|
//clean out
|
|
52
|
-
|
|
54
|
+
// Use dedicated redisQueue client for blocking brpop operation
|
|
55
|
+
// This prevents blocking the main redis client used for cache operations
|
|
56
|
+
let result = await redisQueue.brpop(name,QUEUE_INTERVAL_TIME)
|
|
53
57
|
if(result && result[1]) result = JSON.parse(result[1])
|
|
54
58
|
return result
|
|
55
59
|
}
|