bullmq 6.5.1 → 6.5.3
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/dist/cjs/classes/node-redis-client.js +17 -1
- package/dist/cjs/commands/relayGet-1.lua +5 -5
- package/dist/cjs/commands/relayGetNamespaces-1.lua +1 -1
- package/dist/cjs/scripts/relayGet-1.js +5 -5
- package/dist/cjs/scripts/relayGetNamespaces-1.js +1 -1
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/classes/node-redis-client.js +17 -1
- package/dist/esm/commands/relayGet-1.lua +5 -5
- package/dist/esm/commands/relayGetNamespaces-1.lua +1 -1
- package/dist/esm/scripts/relayGet-1.js +5 -5
- package/dist/esm/scripts/relayGetNamespaces-1.js +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +2 -3
|
@@ -113,11 +113,19 @@ class NodeRedisAdapter extends node_events_1.EventEmitter {
|
|
|
113
113
|
// ---------------------------------------------------------------
|
|
114
114
|
async connect() {
|
|
115
115
|
if (this.connectPromise) {
|
|
116
|
-
|
|
116
|
+
// Reuse the in-flight connection (e.g. the constructor's eager connect).
|
|
117
|
+
// If disconnect() ran while it was pending, the client may still have
|
|
118
|
+
// opened, or the attempt may have been aborted; handle both below.
|
|
119
|
+
await this.connectPromise;
|
|
120
|
+
if (this.raw.isOpen) {
|
|
121
|
+
this.clearEndedState();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
117
124
|
}
|
|
118
125
|
if (!this.raw.isOpen) {
|
|
119
126
|
this.connectPromise = this.raw.connect().then(() => {
|
|
120
127
|
this.connectPromise = undefined;
|
|
128
|
+
this.clearEndedState();
|
|
121
129
|
}, (err) => {
|
|
122
130
|
this.connectPromise = undefined;
|
|
123
131
|
throw err;
|
|
@@ -149,6 +157,14 @@ class NodeRedisAdapter extends node_events_1.EventEmitter {
|
|
|
149
157
|
});
|
|
150
158
|
}
|
|
151
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* An explicit connect() after disconnect() reopens the client
|
|
162
|
+
* (e.g. RedisConnection.reconnect()), so it is no longer ended.
|
|
163
|
+
*/
|
|
164
|
+
clearEndedState() {
|
|
165
|
+
this.statusOverride = undefined;
|
|
166
|
+
this.destroying = false;
|
|
167
|
+
}
|
|
152
168
|
disconnect(reconnect = false) {
|
|
153
169
|
this.destroying = true;
|
|
154
170
|
if (!reconnect) {
|
|
@@ -64,13 +64,13 @@ end
|
|
|
64
64
|
|
|
65
65
|
if view == "counts" then
|
|
66
66
|
return { rcall("ZCARD", KEYS[1]), lexCount("n|"), lexCount("t|"),
|
|
67
|
-
rcall("ZCOUNT", retainedKey,
|
|
67
|
+
rcall("ZCOUNT", retainedKey, getRelayTime() + 1, "+inf") }
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
if view == "used" then
|
|
71
|
-
local
|
|
72
|
-
if rcall("ZCOUNT", KEYS[1],
|
|
73
|
-
rcall("ZCOUNT", retainedKey,
|
|
71
|
+
local after = getRelayTime() + 1
|
|
72
|
+
if rcall("ZCOUNT", KEYS[1], after, "+inf") > 0 or
|
|
73
|
+
rcall("ZCOUNT", retainedKey, after, "+inf") > 0 then
|
|
74
74
|
return 1
|
|
75
75
|
end
|
|
76
76
|
return 0
|
|
@@ -119,7 +119,7 @@ elseif view == "patterns" then
|
|
|
119
119
|
elseif view == "retained" then
|
|
120
120
|
local offset, count = window()
|
|
121
121
|
if count ~= 0 then
|
|
122
|
-
local topics = rcall("ZRANGEBYSCORE", retainedKey,
|
|
122
|
+
local topics = rcall("ZRANGEBYSCORE", retainedKey, getRelayTime() + 1,
|
|
123
123
|
"+inf", "WITHSCORES", "LIMIT", offset, count)
|
|
124
124
|
for i = 1, #topics, 2 do
|
|
125
125
|
local value = rcall("HMGET", baseKey .. ":" .. topics[i] .. ":ret", "m", "ts", "d")
|
|
@@ -11,6 +11,6 @@ local rcall = redis.call
|
|
|
11
11
|
|
|
12
12
|
--- @include "includes/relayTime"
|
|
13
13
|
|
|
14
|
-
local namespaces = rcall("ZRANGEBYSCORE", KEYS[1],
|
|
14
|
+
local namespaces = rcall("ZRANGEBYSCORE", KEYS[1], getRelayTime() + 1, "+inf")
|
|
15
15
|
table.sort(namespaces)
|
|
16
16
|
return namespaces
|
|
@@ -252,12 +252,12 @@ local function lexCount(prefix)
|
|
|
252
252
|
end
|
|
253
253
|
if view == "counts" then
|
|
254
254
|
return { rcall("ZCARD", KEYS[1]), lexCount("n|"), lexCount("t|"),
|
|
255
|
-
rcall("ZCOUNT", retainedKey,
|
|
255
|
+
rcall("ZCOUNT", retainedKey, getRelayTime() + 1, "+inf") }
|
|
256
256
|
end
|
|
257
257
|
if view == "used" then
|
|
258
|
-
local
|
|
259
|
-
if rcall("ZCOUNT", KEYS[1],
|
|
260
|
-
rcall("ZCOUNT", retainedKey,
|
|
258
|
+
local after = getRelayTime() + 1
|
|
259
|
+
if rcall("ZCOUNT", KEYS[1], after, "+inf") > 0 or
|
|
260
|
+
rcall("ZCOUNT", retainedKey, after, "+inf") > 0 then
|
|
261
261
|
return 1
|
|
262
262
|
end
|
|
263
263
|
return 0
|
|
@@ -304,7 +304,7 @@ elseif view == "patterns" then
|
|
|
304
304
|
elseif view == "retained" then
|
|
305
305
|
local offset, count = window()
|
|
306
306
|
if count ~= 0 then
|
|
307
|
-
local topics = rcall("ZRANGEBYSCORE", retainedKey,
|
|
307
|
+
local topics = rcall("ZRANGEBYSCORE", retainedKey, getRelayTime() + 1,
|
|
308
308
|
"+inf", "WITHSCORES", "LIMIT", offset, count)
|
|
309
309
|
for i = 1, #topics, 2 do
|
|
310
310
|
local value = rcall("HMGET", baseKey .. ":" .. topics[i] .. ":ret", "m", "ts", "d")
|
|
@@ -23,7 +23,7 @@ local function getRelayLastScore(key)
|
|
|
23
23
|
local last = rcall("ZRANGE", key, -1, -1, "WITHSCORES")
|
|
24
24
|
return last[2] and tonumber(last[2]) or 0
|
|
25
25
|
end
|
|
26
|
-
local namespaces = rcall("ZRANGEBYSCORE", KEYS[1],
|
|
26
|
+
local namespaces = rcall("ZRANGEBYSCORE", KEYS[1], getRelayTime() + 1, "+inf")
|
|
27
27
|
table.sort(namespaces)
|
|
28
28
|
return namespaces
|
|
29
29
|
`;
|