bullmq 5.41.6 → 5.41.8
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/job.js +1 -0
- package/dist/cjs/classes/job.js.map +1 -1
- package/dist/cjs/commands/addJobScheduler-10.lua +0 -1
- package/dist/cjs/commands/addRepeatableJob-2.lua +2 -2
- package/dist/cjs/commands/cleanJobsInSet-3.lua +7 -5
- package/dist/cjs/commands/getState-8.lua +5 -5
- package/dist/cjs/commands/getStateV2-8.lua +8 -8
- package/dist/cjs/commands/includes/cleanSet.lua +1 -1
- package/dist/cjs/commands/includes/isJobSchedulerJob.lua +1 -1
- package/dist/cjs/commands/includes/trimEvents.lua +1 -1
- package/dist/cjs/commands/includes/updateExistingJobsParent.lua +1 -1
- package/dist/cjs/commands/isFinished-3.lua +2 -2
- package/dist/cjs/commands/updateRepeatableJobMillis-1.lua +1 -1
- package/dist/cjs/scripts/addDelayedJob-6.js +1 -1
- package/dist/cjs/scripts/addJobScheduler-10.js +20 -20
- package/dist/cjs/scripts/addParentJob-4.js +1 -1
- package/dist/cjs/scripts/addPrioritizedJob-8.js +1 -1
- package/dist/cjs/scripts/addRepeatableJob-2.js +2 -2
- package/dist/cjs/scripts/addStandardJob-8.js +1 -1
- package/dist/cjs/scripts/cleanJobsInSet-3.js +9 -7
- package/dist/cjs/scripts/cleanJobsInSet-3.js.map +1 -1
- package/dist/cjs/scripts/getState-8.js +5 -5
- package/dist/cjs/scripts/getStateV2-8.js +8 -8
- package/dist/cjs/scripts/isFinished-3.js +2 -2
- package/dist/cjs/scripts/moveStalledJobsToWait-9.js +1 -1
- package/dist/cjs/scripts/moveToFinished-14.js +1 -1
- package/dist/cjs/scripts/removeJob-3.js +1 -1
- package/dist/cjs/scripts/updateRepeatableJobMillis-1.js +1 -1
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/classes/job.js +1 -0
- package/dist/esm/classes/job.js.map +1 -1
- package/dist/esm/commands/addJobScheduler-10.lua +0 -1
- package/dist/esm/commands/addRepeatableJob-2.lua +2 -2
- package/dist/esm/commands/cleanJobsInSet-3.lua +7 -5
- package/dist/esm/commands/getState-8.lua +5 -5
- package/dist/esm/commands/getStateV2-8.lua +8 -8
- package/dist/esm/commands/includes/cleanSet.lua +1 -1
- package/dist/esm/commands/includes/isJobSchedulerJob.lua +1 -1
- package/dist/esm/commands/includes/trimEvents.lua +1 -1
- package/dist/esm/commands/includes/updateExistingJobsParent.lua +1 -1
- package/dist/esm/commands/isFinished-3.lua +2 -2
- package/dist/esm/commands/updateRepeatableJobMillis-1.lua +1 -1
- package/dist/esm/interfaces/job-json.d.ts +1 -0
- package/dist/esm/scripts/addDelayedJob-6.js +1 -1
- package/dist/esm/scripts/addJobScheduler-10.js +20 -20
- package/dist/esm/scripts/addParentJob-4.js +1 -1
- package/dist/esm/scripts/addPrioritizedJob-8.js +1 -1
- package/dist/esm/scripts/addRepeatableJob-2.js +2 -2
- package/dist/esm/scripts/addStandardJob-8.js +1 -1
- package/dist/esm/scripts/cleanJobsInSet-3.js +9 -7
- package/dist/esm/scripts/cleanJobsInSet-3.js.map +1 -1
- package/dist/esm/scripts/getState-8.js +5 -5
- package/dist/esm/scripts/getStateV2-8.js +8 -8
- package/dist/esm/scripts/isFinished-3.js +2 -2
- package/dist/esm/scripts/moveStalledJobsToWait-9.js +1 -1
- package/dist/esm/scripts/moveToFinished-14.js +1 -1
- package/dist/esm/scripts/removeJob-3.js +1 -1
- package/dist/esm/scripts/updateRepeatableJobMillis-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 +1 -1
@@ -23,35 +23,35 @@
|
|
23
23
|
]]
|
24
24
|
local rcall = redis.call
|
25
25
|
|
26
|
-
if rcall("ZSCORE", KEYS[1], ARGV[1])
|
26
|
+
if rcall("ZSCORE", KEYS[1], ARGV[1]) then
|
27
27
|
return "completed"
|
28
28
|
end
|
29
29
|
|
30
|
-
if rcall("ZSCORE", KEYS[2], ARGV[1])
|
30
|
+
if rcall("ZSCORE", KEYS[2], ARGV[1]) then
|
31
31
|
return "failed"
|
32
32
|
end
|
33
33
|
|
34
|
-
if rcall("ZSCORE", KEYS[3], ARGV[1])
|
34
|
+
if rcall("ZSCORE", KEYS[3], ARGV[1]) then
|
35
35
|
return "delayed"
|
36
36
|
end
|
37
37
|
|
38
|
-
if rcall("ZSCORE", KEYS[8], ARGV[1])
|
38
|
+
if rcall("ZSCORE", KEYS[8], ARGV[1]) then
|
39
39
|
return "prioritized"
|
40
40
|
end
|
41
41
|
|
42
|
-
if rcall("LPOS", KEYS[4] , ARGV[1])
|
42
|
+
if rcall("LPOS", KEYS[4] , ARGV[1]) then
|
43
43
|
return "active"
|
44
44
|
end
|
45
45
|
|
46
|
-
if rcall("LPOS", KEYS[5] , ARGV[1])
|
46
|
+
if rcall("LPOS", KEYS[5] , ARGV[1]) then
|
47
47
|
return "waiting"
|
48
48
|
end
|
49
49
|
|
50
|
-
if rcall("LPOS", KEYS[6] , ARGV[1])
|
50
|
+
if rcall("LPOS", KEYS[6] , ARGV[1]) then
|
51
51
|
return "waiting"
|
52
52
|
end
|
53
53
|
|
54
|
-
if rcall("ZSCORE", KEYS[7] , ARGV[1])
|
54
|
+
if rcall("ZSCORE", KEYS[7] , ARGV[1]) then
|
55
55
|
return "waiting-children"
|
56
56
|
end
|
57
57
|
|
@@ -31,7 +31,7 @@ local function cleanSet(
|
|
31
31
|
local jobKey = jobKeyPrefix .. job
|
32
32
|
-- Extract a Job Scheduler Id from jobId ("repeat:job-scheduler-id:millis")
|
33
33
|
-- and check if it is in the scheduled jobs
|
34
|
-
if not isJobSchedulerJob(job, jobKey, jobSchedulersKey) then
|
34
|
+
if not (jobSchedulersKey and isJobSchedulerJob(job, jobKey, jobSchedulersKey)) then
|
35
35
|
if isFinished then
|
36
36
|
removeJob(job, true, jobKeyPrefix, true --[[remove debounce key]] )
|
37
37
|
deletedCount = deletedCount + 1
|
@@ -6,7 +6,7 @@ local function isJobSchedulerJob(jobId, jobKey, jobSchedulersKey)
|
|
6
6
|
local repeatJobKey = rcall("HGET", jobKey, "rjk")
|
7
7
|
if repeatJobKey then
|
8
8
|
local prevMillis = rcall("ZSCORE", jobSchedulersKey, repeatJobKey)
|
9
|
-
if prevMillis
|
9
|
+
if prevMillis then
|
10
10
|
local currentDelayedJobId = "repeat:" .. repeatJobKey .. ":" .. prevMillis
|
11
11
|
return jobId == currentDelayedJobId
|
12
12
|
end
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
local function trimEvents(metaKey, eventStreamKey)
|
9
9
|
local maxEvents = getOrSetMaxEvents(metaKey)
|
10
|
-
if maxEvents
|
10
|
+
if maxEvents then
|
11
11
|
rcall("XTRIM", eventStreamKey, "MAXLEN", "~", maxEvents)
|
12
12
|
else
|
13
13
|
rcall("XTRIM", eventStreamKey, "MAXLEN", "~", 10000)
|
@@ -12,7 +12,7 @@ local function updateExistingJobsParent(parentKey, parent, parentData,
|
|
12
12
|
parentDependenciesKey, completedKey,
|
13
13
|
jobIdKey, jobId, timestamp)
|
14
14
|
if parentKey ~= nil then
|
15
|
-
if rcall("ZSCORE", completedKey, jobId)
|
15
|
+
if rcall("ZSCORE", completedKey, jobId) then
|
16
16
|
local returnvalue = rcall("HGET", jobIdKey, "returnvalue")
|
17
17
|
updateParentDepsIfNeeded(parentKey, parent['queueKey'],
|
18
18
|
parentDependenciesKey, parent['id'],
|
@@ -23,7 +23,7 @@ if rcall("EXISTS", KEYS[3]) ~= 1 then
|
|
23
23
|
return -1
|
24
24
|
end
|
25
25
|
|
26
|
-
if rcall("ZSCORE", KEYS[1], ARGV[1])
|
26
|
+
if rcall("ZSCORE", KEYS[1], ARGV[1]) then
|
27
27
|
if ARGV[2] == "1" then
|
28
28
|
local returnValue = rcall("HGET", KEYS[3], "returnvalue")
|
29
29
|
|
@@ -32,7 +32,7 @@ if rcall("ZSCORE", KEYS[1], ARGV[1]) ~= false then
|
|
32
32
|
return 1
|
33
33
|
end
|
34
34
|
|
35
|
-
if rcall("ZSCORE", KEYS[2], ARGV[1])
|
35
|
+
if rcall("ZSCORE", KEYS[2], ARGV[1]) then
|
36
36
|
if ARGV[2] == "1" then
|
37
37
|
local failedReason = rcall("HGET", KEYS[3], "failedReason")
|
38
38
|
|
@@ -17,7 +17,7 @@ local nextMillis = ARGV[1]
|
|
17
17
|
local customKey = ARGV[2]
|
18
18
|
local legacyCustomKey = ARGV[3]
|
19
19
|
|
20
|
-
if rcall("ZSCORE", repeatKey, customKey)
|
20
|
+
if rcall("ZSCORE", repeatKey, customKey) then
|
21
21
|
rcall("ZADD", repeatKey, nextMillis, customKey)
|
22
22
|
return customKey
|
23
23
|
elseif rcall("ZSCORE", repeatKey, legacyCustomKey) ~= false then
|
@@ -281,7 +281,7 @@ local function updateExistingJobsParent(parentKey, parent, parentData,
|
|
281
281
|
parentDependenciesKey, completedKey,
|
282
282
|
jobIdKey, jobId, timestamp)
|
283
283
|
if parentKey ~= nil then
|
284
|
-
if rcall("ZSCORE", completedKey, jobId)
|
284
|
+
if rcall("ZSCORE", completedKey, jobId) then
|
285
285
|
local returnvalue = rcall("HGET", jobIdKey, "returnvalue")
|
286
286
|
updateParentDepsIfNeeded(parentKey, parent['queueKey'],
|
287
287
|
parentDependenciesKey, parent['id'],
|
@@ -141,26 +141,6 @@ end
|
|
141
141
|
Function to check for the meta.paused key to decide if we are paused or not
|
142
142
|
(since an empty list and !EXISTS are not really the same).
|
143
143
|
]]
|
144
|
-
local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
|
145
|
-
local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
|
146
|
-
if queueAttributes[1] then
|
147
|
-
return pausedKey, true
|
148
|
-
else
|
149
|
-
if queueAttributes[2] then
|
150
|
-
local activeCount = rcall("LLEN", activeKey)
|
151
|
-
if activeCount >= tonumber(queueAttributes[2]) then
|
152
|
-
return waitKey, true
|
153
|
-
else
|
154
|
-
return waitKey, false
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
|
-
return waitKey, false
|
159
|
-
end
|
160
|
-
--[[
|
161
|
-
Function to check for the meta.paused key to decide if we are paused or not
|
162
|
-
(since an empty list and !EXISTS are not really the same).
|
163
|
-
]]
|
164
144
|
local function isQueuePaused(queueMetaKey)
|
165
145
|
return rcall("HEXISTS", queueMetaKey, "paused") == 1
|
166
146
|
end
|
@@ -209,6 +189,26 @@ end
|
|
209
189
|
local getJobKeyPrefix = function (jobKey, jobId)
|
210
190
|
return string.sub(jobKey, 0, #jobKey - #jobId)
|
211
191
|
end
|
192
|
+
--[[
|
193
|
+
Function to check for the meta.paused key to decide if we are paused or not
|
194
|
+
(since an empty list and !EXISTS are not really the same).
|
195
|
+
]]
|
196
|
+
local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
|
197
|
+
local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
|
198
|
+
if queueAttributes[1] then
|
199
|
+
return pausedKey, true
|
200
|
+
else
|
201
|
+
if queueAttributes[2] then
|
202
|
+
local activeCount = rcall("LLEN", activeKey)
|
203
|
+
if activeCount >= tonumber(queueAttributes[2]) then
|
204
|
+
return waitKey, true
|
205
|
+
else
|
206
|
+
return waitKey, false
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
210
|
+
return waitKey, false
|
211
|
+
end
|
212
212
|
local function moveParentToWait(parentPrefix, parentId, emitEvent)
|
213
213
|
local parentTarget, isPausedOrMaxed = getTargetQueueList(parentPrefix .. "meta", parentPrefix .. "active",
|
214
214
|
parentPrefix .. "wait", parentPrefix .. "paused")
|
@@ -237,7 +237,7 @@ local function updateExistingJobsParent(parentKey, parent, parentData,
|
|
237
237
|
parentDependenciesKey, completedKey,
|
238
238
|
jobIdKey, jobId, timestamp)
|
239
239
|
if parentKey ~= nil then
|
240
|
-
if rcall("ZSCORE", completedKey, jobId)
|
240
|
+
if rcall("ZSCORE", completedKey, jobId) then
|
241
241
|
local returnvalue = rcall("HGET", jobIdKey, "returnvalue")
|
242
242
|
updateParentDepsIfNeeded(parentKey, parent['queueKey'],
|
243
243
|
parentDependenciesKey, parent['id'],
|
@@ -274,7 +274,7 @@ local function updateExistingJobsParent(parentKey, parent, parentData,
|
|
274
274
|
parentDependenciesKey, completedKey,
|
275
275
|
jobIdKey, jobId, timestamp)
|
276
276
|
if parentKey ~= nil then
|
277
|
-
if rcall("ZSCORE", completedKey, jobId)
|
277
|
+
if rcall("ZSCORE", completedKey, jobId) then
|
278
278
|
local returnvalue = rcall("HGET", jobIdKey, "returnvalue")
|
279
279
|
updateParentDepsIfNeeded(parentKey, parent['queueKey'],
|
280
280
|
parentDependenciesKey, parent['id'],
|
@@ -204,10 +204,10 @@ end
|
|
204
204
|
-- If we are overriding a repeatable job we must delete the delayed job for
|
205
205
|
-- the next iteration.
|
206
206
|
local prevMillis = rcall("ZSCORE", repeatKey, customKey)
|
207
|
-
if prevMillis
|
207
|
+
if prevMillis then
|
208
208
|
local delayedJobId = "repeat:" .. customKey .. ":" .. prevMillis
|
209
209
|
local nextDelayedJobId = repeatKey .. ":" .. customKey .. ":" .. nextMillis
|
210
|
-
if rcall("ZSCORE", delayedKey, delayedJobId)
|
210
|
+
if rcall("ZSCORE", delayedKey, delayedJobId)
|
211
211
|
and rcall("EXISTS", nextDelayedJobId) ~= 1 then
|
212
212
|
removeJob(delayedJobId, true, prefixKey, true --[[remove debounce key]])
|
213
213
|
rcall("ZREM", delayedKey, delayedJobId)
|
@@ -247,7 +247,7 @@ local function updateExistingJobsParent(parentKey, parent, parentData,
|
|
247
247
|
parentDependenciesKey, completedKey,
|
248
248
|
jobIdKey, jobId, timestamp)
|
249
249
|
if parentKey ~= nil then
|
250
|
-
if rcall("ZSCORE", completedKey, jobId)
|
250
|
+
if rcall("ZSCORE", completedKey, jobId) then
|
251
251
|
local returnvalue = rcall("HGET", jobIdKey, "returnvalue")
|
252
252
|
updateParentDepsIfNeeded(parentKey, parent['queueKey'],
|
253
253
|
parentDependenciesKey, parent['id'],
|
@@ -3,13 +3,14 @@ const content = `--[[
|
|
3
3
|
Input:
|
4
4
|
KEYS[1] set key,
|
5
5
|
KEYS[2] events stream key
|
6
|
-
KEYS[3]
|
6
|
+
KEYS[3] repeat key
|
7
7
|
ARGV[1] jobKey prefix
|
8
8
|
ARGV[2] timestamp
|
9
9
|
ARGV[3] limit the number of jobs to be removed. 0 is unlimited
|
10
10
|
ARGV[4] set name, can be any of 'wait', 'active', 'paused', 'delayed', 'completed', or 'failed'
|
11
11
|
]]
|
12
12
|
local rcall = redis.call
|
13
|
+
local repeatKey = KEYS[3]
|
13
14
|
local rangeStart = 0
|
14
15
|
local rangeEnd = -1
|
15
16
|
local limit = tonumber(ARGV[3])
|
@@ -52,7 +53,7 @@ local function isJobSchedulerJob(jobId, jobKey, jobSchedulersKey)
|
|
52
53
|
local repeatJobKey = rcall("HGET", jobKey, "rjk")
|
53
54
|
if repeatJobKey then
|
54
55
|
local prevMillis = rcall("ZSCORE", jobSchedulersKey, repeatJobKey)
|
55
|
-
if prevMillis
|
56
|
+
if prevMillis then
|
56
57
|
local currentDelayedJobId = "repeat:" .. repeatJobKey .. ":" .. prevMillis
|
57
58
|
return jobId == currentDelayedJobId
|
58
59
|
end
|
@@ -302,7 +303,7 @@ local function cleanSet(
|
|
302
303
|
local jobKey = jobKeyPrefix .. job
|
303
304
|
-- Extract a Job Scheduler Id from jobId ("repeat:job-scheduler-id:millis")
|
304
305
|
-- and check if it is in the scheduled jobs
|
305
|
-
if not isJobSchedulerJob(job, jobKey, jobSchedulersKey) then
|
306
|
+
if not (jobSchedulersKey and isJobSchedulerJob(job, jobKey, jobSchedulersKey)) then
|
306
307
|
if isFinished then
|
307
308
|
removeJob(job, true, jobKeyPrefix, true --[[remove debounce key]] )
|
308
309
|
deletedCount = deletedCount + 1
|
@@ -328,20 +329,21 @@ end
|
|
328
329
|
local result
|
329
330
|
if ARGV[4] == "active" then
|
330
331
|
result = cleanList(KEYS[1], ARGV[1], rangeStart, rangeEnd, ARGV[2], false --[[ hasFinished ]],
|
331
|
-
|
332
|
+
repeatKey)
|
332
333
|
elseif ARGV[4] == "delayed" then
|
333
334
|
rangeEnd = "+inf"
|
334
335
|
result = cleanSet(KEYS[1], ARGV[1], rangeEnd, ARGV[2], limit,
|
335
|
-
{"processedOn", "timestamp"}, false --[[ hasFinished ]],
|
336
|
+
{"processedOn", "timestamp"}, false --[[ hasFinished ]], repeatKey)
|
336
337
|
elseif ARGV[4] == "prioritized" then
|
337
338
|
rangeEnd = "+inf"
|
338
339
|
result = cleanSet(KEYS[1], ARGV[1], rangeEnd, ARGV[2], limit,
|
339
|
-
{"timestamp"}, false --[[ hasFinished ]])
|
340
|
+
{"timestamp"}, false --[[ hasFinished ]], repeatKey)
|
340
341
|
elseif ARGV[4] == "wait" or ARGV[4] == "paused" then
|
341
342
|
result = cleanList(KEYS[1], ARGV[1], rangeStart, rangeEnd, ARGV[2], true --[[ hasFinished ]],
|
342
|
-
|
343
|
+
repeatKey)
|
343
344
|
else
|
344
345
|
rangeEnd = ARGV[2]
|
346
|
+
-- No need to pass repeat key as in that moment job won't be related to a job scheduler
|
345
347
|
result = cleanSet(KEYS[1], ARGV[1], rangeEnd, ARGV[2], limit,
|
346
348
|
{"finishedOn"}, true --[[ hasFinished ]])
|
347
349
|
end
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cleanJobsInSet-3.js","sourceRoot":"","sources":["../../../src/scripts/cleanJobsInSet-3.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"cleanJobsInSet-3.js","sourceRoot":"","sources":["../../../src/scripts/cleanJobsInSet-3.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Vf,CAAC;AACF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -21,16 +21,16 @@ const content = `--[[
|
|
21
21
|
'unknown'
|
22
22
|
]]
|
23
23
|
local rcall = redis.call
|
24
|
-
if rcall("ZSCORE", KEYS[1], ARGV[1])
|
24
|
+
if rcall("ZSCORE", KEYS[1], ARGV[1]) then
|
25
25
|
return "completed"
|
26
26
|
end
|
27
|
-
if rcall("ZSCORE", KEYS[2], ARGV[1])
|
27
|
+
if rcall("ZSCORE", KEYS[2], ARGV[1]) then
|
28
28
|
return "failed"
|
29
29
|
end
|
30
|
-
if rcall("ZSCORE", KEYS[3], ARGV[1])
|
30
|
+
if rcall("ZSCORE", KEYS[3], ARGV[1]) then
|
31
31
|
return "delayed"
|
32
32
|
end
|
33
|
-
if rcall("ZSCORE", KEYS[8], ARGV[1])
|
33
|
+
if rcall("ZSCORE", KEYS[8], ARGV[1]) then
|
34
34
|
return "prioritized"
|
35
35
|
end
|
36
36
|
-- Includes
|
@@ -57,7 +57,7 @@ local paused_items = rcall("LRANGE", KEYS[6] , 0, -1)
|
|
57
57
|
if checkItemInList(paused_items, ARGV[1]) ~= nil then
|
58
58
|
return "waiting"
|
59
59
|
end
|
60
|
-
if rcall("ZSCORE", KEYS[7], ARGV[1])
|
60
|
+
if rcall("ZSCORE", KEYS[7], ARGV[1]) then
|
61
61
|
return "waiting-children"
|
62
62
|
end
|
63
63
|
return "unknown"
|
@@ -20,28 +20,28 @@ const content = `--[[
|
|
20
20
|
'unknown'
|
21
21
|
]]
|
22
22
|
local rcall = redis.call
|
23
|
-
if rcall("ZSCORE", KEYS[1], ARGV[1])
|
23
|
+
if rcall("ZSCORE", KEYS[1], ARGV[1]) then
|
24
24
|
return "completed"
|
25
25
|
end
|
26
|
-
if rcall("ZSCORE", KEYS[2], ARGV[1])
|
26
|
+
if rcall("ZSCORE", KEYS[2], ARGV[1]) then
|
27
27
|
return "failed"
|
28
28
|
end
|
29
|
-
if rcall("ZSCORE", KEYS[3], ARGV[1])
|
29
|
+
if rcall("ZSCORE", KEYS[3], ARGV[1]) then
|
30
30
|
return "delayed"
|
31
31
|
end
|
32
|
-
if rcall("ZSCORE", KEYS[8], ARGV[1])
|
32
|
+
if rcall("ZSCORE", KEYS[8], ARGV[1]) then
|
33
33
|
return "prioritized"
|
34
34
|
end
|
35
|
-
if rcall("LPOS", KEYS[4] , ARGV[1])
|
35
|
+
if rcall("LPOS", KEYS[4] , ARGV[1]) then
|
36
36
|
return "active"
|
37
37
|
end
|
38
|
-
if rcall("LPOS", KEYS[5] , ARGV[1])
|
38
|
+
if rcall("LPOS", KEYS[5] , ARGV[1]) then
|
39
39
|
return "waiting"
|
40
40
|
end
|
41
|
-
if rcall("LPOS", KEYS[6] , ARGV[1])
|
41
|
+
if rcall("LPOS", KEYS[6] , ARGV[1]) then
|
42
42
|
return "waiting"
|
43
43
|
end
|
44
|
-
if rcall("ZSCORE", KEYS[7] , ARGV[1])
|
44
|
+
if rcall("ZSCORE", KEYS[7] , ARGV[1]) then
|
45
45
|
return "waiting-children"
|
46
46
|
end
|
47
47
|
return "unknown"
|
@@ -19,14 +19,14 @@ if rcall("EXISTS", KEYS[3]) ~= 1 then
|
|
19
19
|
end
|
20
20
|
return -1
|
21
21
|
end
|
22
|
-
if rcall("ZSCORE", KEYS[1], ARGV[1])
|
22
|
+
if rcall("ZSCORE", KEYS[1], ARGV[1]) then
|
23
23
|
if ARGV[2] == "1" then
|
24
24
|
local returnValue = rcall("HGET", KEYS[3], "returnvalue")
|
25
25
|
return {1,returnValue}
|
26
26
|
end
|
27
27
|
return 1
|
28
28
|
end
|
29
|
-
if rcall("ZSCORE", KEYS[2], ARGV[1])
|
29
|
+
if rcall("ZSCORE", KEYS[2], ARGV[1]) then
|
30
30
|
if ARGV[2] == "1" then
|
31
31
|
local failedReason = rcall("HGET", KEYS[3], "failedReason")
|
32
32
|
return {2,failedReason}
|
@@ -454,7 +454,7 @@ local function getOrSetMaxEvents(metaKey)
|
|
454
454
|
end
|
455
455
|
local function trimEvents(metaKey, eventStreamKey)
|
456
456
|
local maxEvents = getOrSetMaxEvents(metaKey)
|
457
|
-
if maxEvents
|
457
|
+
if maxEvents then
|
458
458
|
rcall("XTRIM", eventStreamKey, "MAXLEN", "~", maxEvents)
|
459
459
|
else
|
460
460
|
rcall("XTRIM", eventStreamKey, "MAXLEN", "~", 10000)
|
@@ -637,7 +637,7 @@ local function getOrSetMaxEvents(metaKey)
|
|
637
637
|
end
|
638
638
|
local function trimEvents(metaKey, eventStreamKey)
|
639
639
|
local maxEvents = getOrSetMaxEvents(metaKey)
|
640
|
-
if maxEvents
|
640
|
+
if maxEvents then
|
641
641
|
rcall("XTRIM", eventStreamKey, "MAXLEN", "~", maxEvents)
|
642
642
|
else
|
643
643
|
rcall("XTRIM", eventStreamKey, "MAXLEN", "~", 10000)
|
@@ -41,7 +41,7 @@ local function isJobSchedulerJob(jobId, jobKey, jobSchedulersKey)
|
|
41
41
|
local repeatJobKey = rcall("HGET", jobKey, "rjk")
|
42
42
|
if repeatJobKey then
|
43
43
|
local prevMillis = rcall("ZSCORE", jobSchedulersKey, repeatJobKey)
|
44
|
-
if prevMillis
|
44
|
+
if prevMillis then
|
45
45
|
local currentDelayedJobId = "repeat:" .. repeatJobKey .. ":" .. prevMillis
|
46
46
|
return jobId == currentDelayedJobId
|
47
47
|
end
|
@@ -13,7 +13,7 @@ local repeatKey = KEYS[1]
|
|
13
13
|
local nextMillis = ARGV[1]
|
14
14
|
local customKey = ARGV[2]
|
15
15
|
local legacyCustomKey = ARGV[3]
|
16
|
-
if rcall("ZSCORE", repeatKey, customKey)
|
16
|
+
if rcall("ZSCORE", repeatKey, customKey) then
|
17
17
|
rcall("ZADD", repeatKey, nextMillis, customKey)
|
18
18
|
return customKey
|
19
19
|
elseif rcall("ZSCORE", repeatKey, legacyCustomKey) ~= false then
|