bullmq 5.8.7 → 5.9.0
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/queue.js +29 -0
- package/dist/cjs/classes/queue.js.map +1 -1
- package/dist/cjs/classes/scripts.js +17 -1
- package/dist/cjs/classes/scripts.js.map +1 -1
- package/dist/cjs/classes/worker.js +1 -1
- package/dist/cjs/classes/worker.js.map +1 -1
- package/dist/cjs/commands/{addPrioritizedJob-7.lua → addPrioritizedJob-8.lua} +9 -7
- package/dist/cjs/commands/{addStandardJob-7.lua → addStandardJob-8.lua} +6 -5
- package/dist/cjs/commands/{changePriority-6.lua → changePriority-7.lua} +12 -10
- package/dist/cjs/commands/getCountsPerPriority-4.lua +6 -3
- package/dist/cjs/commands/includes/addBaseMarkerIfNeeded.lua +2 -2
- package/dist/cjs/commands/includes/addJobInTargetList.lua +2 -2
- package/dist/cjs/commands/includes/addJobWithPriority.lua +3 -2
- package/dist/cjs/commands/includes/getTargetQueueList.lua +14 -4
- package/dist/cjs/commands/includes/isQueueMaxed.lua +15 -0
- package/dist/cjs/commands/includes/isQueuePaused.lua +1 -1
- package/dist/cjs/commands/includes/isQueuePausedOrMaxed.lua +18 -0
- package/dist/cjs/commands/includes/moveParentToWaitIfNeeded.lua +8 -6
- package/dist/cjs/commands/includes/removeParentDependencyKey.lua +3 -3
- package/dist/cjs/commands/isMaxed-2.lua +17 -0
- package/dist/cjs/commands/moveJobFromActiveToWait-10.lua +2 -2
- package/dist/{esm/commands/moveJobsToWait-7.lua → cjs/commands/moveJobsToWait-8.lua} +4 -3
- package/dist/cjs/commands/moveStalledJobsToWait-9.lua +3 -3
- package/dist/cjs/commands/moveToActive-11.lua +4 -4
- package/dist/cjs/commands/moveToFinished-14.lua +4 -4
- package/dist/cjs/commands/moveToWaitingChildren-5.lua +4 -3
- package/dist/{esm/commands/promote-8.lua → cjs/commands/promote-9.lua} +9 -7
- package/dist/{esm/commands/removeJob-1.lua → cjs/commands/removeJob-2.lua} +2 -1
- package/dist/{esm/commands/reprocessJob-7.lua → cjs/commands/reprocessJob-8.lua} +4 -3
- package/dist/cjs/commands/retryJob-11.lua +8 -4
- package/dist/cjs/scripts/addDelayedJob-6.js +39 -18
- package/dist/cjs/scripts/addDelayedJob-6.js.map +1 -1
- package/dist/cjs/scripts/addParentJob-4.js +39 -18
- package/dist/cjs/scripts/addParentJob-4.js.map +1 -1
- package/dist/cjs/scripts/{addPrioritizedJob-7.js → addPrioritizedJob-8.js} +49 -26
- package/dist/cjs/scripts/addPrioritizedJob-8.js.map +1 -0
- package/dist/cjs/scripts/{addStandardJob-7.js → addStandardJob-8.js} +47 -25
- package/dist/cjs/scripts/addStandardJob-8.js.map +1 -0
- package/dist/cjs/scripts/{changePriority-6.js → changePriority-7.js} +33 -21
- package/dist/cjs/scripts/changePriority-7.js.map +1 -0
- package/dist/cjs/scripts/cleanJobsInSet-2.js +20 -11
- package/dist/cjs/scripts/cleanJobsInSet-2.js.map +1 -1
- package/dist/cjs/scripts/drain-4.js +20 -11
- package/dist/cjs/scripts/drain-4.js.map +1 -1
- package/dist/cjs/scripts/getCountsPerPriority-4.js +7 -8
- package/dist/cjs/scripts/getCountsPerPriority-4.js.map +1 -1
- package/dist/cjs/scripts/index.js +8 -7
- package/dist/cjs/scripts/index.js.map +1 -1
- package/dist/cjs/scripts/isMaxed-2.js +34 -0
- package/dist/cjs/scripts/isMaxed-2.js.map +1 -0
- package/dist/cjs/scripts/moveJobFromActiveToWait-10.js +19 -10
- package/dist/cjs/scripts/moveJobFromActiveToWait-10.js.map +1 -1
- package/dist/cjs/scripts/{moveJobsToWait-7.js → moveJobsToWait-8.js} +21 -11
- package/dist/cjs/scripts/moveJobsToWait-8.js.map +1 -0
- package/dist/cjs/scripts/moveStalledJobsToWait-9.js +45 -24
- package/dist/cjs/scripts/moveStalledJobsToWait-9.js.map +1 -1
- package/dist/cjs/scripts/moveToActive-11.js +24 -14
- package/dist/cjs/scripts/moveToActive-11.js.map +1 -1
- package/dist/cjs/scripts/moveToFinished-14.js +46 -25
- package/dist/cjs/scripts/moveToFinished-14.js.map +1 -1
- package/dist/cjs/scripts/moveToWaitingChildren-5.js +4 -3
- package/dist/cjs/scripts/moveToWaitingChildren-5.js.map +1 -1
- package/dist/cjs/scripts/obliterate-2.js +20 -11
- package/dist/cjs/scripts/obliterate-2.js.map +1 -1
- package/dist/cjs/scripts/{promote-8.js → promote-9.js} +31 -19
- package/dist/cjs/scripts/promote-9.js.map +1 -0
- package/dist/cjs/scripts/removeChildDependency-1.js +20 -11
- package/dist/cjs/scripts/removeChildDependency-1.js.map +1 -1
- package/dist/cjs/scripts/{removeJob-1.js → removeJob-2.js} +24 -14
- package/dist/cjs/scripts/{removeJob-1.js.map → removeJob-2.js.map} +1 -1
- package/dist/cjs/scripts/{reprocessJob-7.js → reprocessJob-8.js} +23 -13
- package/dist/cjs/scripts/reprocessJob-8.js.map +1 -0
- package/dist/cjs/scripts/retryJob-11.js +42 -14
- package/dist/cjs/scripts/retryJob-11.js.map +1 -1
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/esm/classes/queue.d.ts +17 -0
- package/dist/esm/classes/queue.js +29 -0
- package/dist/esm/classes/queue.js.map +1 -1
- package/dist/esm/classes/scripts.d.ts +2 -0
- package/dist/esm/classes/scripts.js +17 -1
- package/dist/esm/classes/scripts.js.map +1 -1
- package/dist/esm/classes/worker.js +1 -1
- package/dist/esm/classes/worker.js.map +1 -1
- package/dist/esm/commands/{addPrioritizedJob-7.lua → addPrioritizedJob-8.lua} +9 -7
- package/dist/esm/commands/{addStandardJob-7.lua → addStandardJob-8.lua} +6 -5
- package/dist/esm/commands/{changePriority-6.lua → changePriority-7.lua} +12 -10
- package/dist/esm/commands/getCountsPerPriority-4.lua +6 -3
- package/dist/esm/commands/includes/addBaseMarkerIfNeeded.lua +2 -2
- package/dist/esm/commands/includes/addJobInTargetList.lua +2 -2
- package/dist/esm/commands/includes/addJobWithPriority.lua +3 -2
- package/dist/esm/commands/includes/getTargetQueueList.lua +14 -4
- package/dist/esm/commands/includes/isQueueMaxed.lua +15 -0
- package/dist/esm/commands/includes/isQueuePaused.lua +1 -1
- package/dist/esm/commands/includes/isQueuePausedOrMaxed.lua +18 -0
- package/dist/esm/commands/includes/moveParentToWaitIfNeeded.lua +8 -6
- package/dist/esm/commands/includes/removeParentDependencyKey.lua +3 -3
- package/dist/esm/commands/isMaxed-2.lua +17 -0
- package/dist/esm/commands/moveJobFromActiveToWait-10.lua +2 -2
- package/dist/{cjs/commands/moveJobsToWait-7.lua → esm/commands/moveJobsToWait-8.lua} +4 -3
- package/dist/esm/commands/moveStalledJobsToWait-9.lua +3 -3
- package/dist/esm/commands/moveToActive-11.lua +4 -4
- package/dist/esm/commands/moveToFinished-14.lua +4 -4
- package/dist/esm/commands/moveToWaitingChildren-5.lua +4 -3
- package/dist/{cjs/commands/promote-8.lua → esm/commands/promote-9.lua} +9 -7
- package/dist/{cjs/commands/removeJob-1.lua → esm/commands/removeJob-2.lua} +2 -1
- package/dist/{cjs/commands/reprocessJob-7.lua → esm/commands/reprocessJob-8.lua} +4 -3
- package/dist/esm/commands/retryJob-11.lua +8 -4
- package/dist/esm/scripts/addDelayedJob-6.js +39 -18
- package/dist/esm/scripts/addDelayedJob-6.js.map +1 -1
- package/dist/esm/scripts/addParentJob-4.js +39 -18
- package/dist/esm/scripts/addParentJob-4.js.map +1 -1
- package/dist/esm/scripts/{addPrioritizedJob-7.js → addPrioritizedJob-8.js} +49 -26
- package/dist/esm/scripts/addPrioritizedJob-8.js.map +1 -0
- package/dist/esm/scripts/{addStandardJob-7.js → addStandardJob-8.js} +47 -25
- package/dist/esm/scripts/addStandardJob-8.js.map +1 -0
- package/dist/esm/scripts/{changePriority-6.js → changePriority-7.js} +33 -21
- package/dist/esm/scripts/changePriority-7.js.map +1 -0
- package/dist/esm/scripts/cleanJobsInSet-2.js +20 -11
- package/dist/esm/scripts/cleanJobsInSet-2.js.map +1 -1
- package/dist/esm/scripts/drain-4.js +20 -11
- package/dist/esm/scripts/drain-4.js.map +1 -1
- package/dist/esm/scripts/getCountsPerPriority-4.js +7 -8
- package/dist/esm/scripts/getCountsPerPriority-4.js.map +1 -1
- package/dist/esm/scripts/index.d.ts +8 -7
- package/dist/esm/scripts/index.js +8 -7
- package/dist/esm/scripts/index.js.map +1 -1
- package/dist/esm/scripts/isMaxed-2.d.ts +5 -0
- package/dist/esm/scripts/isMaxed-2.js +31 -0
- package/dist/esm/scripts/isMaxed-2.js.map +1 -0
- package/dist/esm/scripts/moveJobFromActiveToWait-10.js +19 -10
- package/dist/esm/scripts/moveJobFromActiveToWait-10.js.map +1 -1
- package/dist/esm/scripts/{moveJobsToWait-7.js → moveJobsToWait-8.js} +21 -11
- package/dist/esm/scripts/moveJobsToWait-8.js.map +1 -0
- package/dist/esm/scripts/moveStalledJobsToWait-9.js +45 -24
- package/dist/esm/scripts/moveStalledJobsToWait-9.js.map +1 -1
- package/dist/esm/scripts/moveToActive-11.js +24 -14
- package/dist/esm/scripts/moveToActive-11.js.map +1 -1
- package/dist/esm/scripts/moveToFinished-14.js +46 -25
- package/dist/esm/scripts/moveToFinished-14.js.map +1 -1
- package/dist/esm/scripts/moveToWaitingChildren-5.js +4 -3
- package/dist/esm/scripts/moveToWaitingChildren-5.js.map +1 -1
- package/dist/esm/scripts/obliterate-2.js +20 -11
- package/dist/esm/scripts/obliterate-2.js.map +1 -1
- package/dist/esm/scripts/{promote-8.js → promote-9.js} +31 -19
- package/dist/esm/scripts/promote-9.js.map +1 -0
- package/dist/esm/scripts/removeChildDependency-1.js +20 -11
- package/dist/esm/scripts/removeChildDependency-1.js.map +1 -1
- package/dist/esm/scripts/{removeJob-1.js → removeJob-2.js} +24 -14
- package/dist/esm/scripts/{removeJob-1.js.map → removeJob-2.js.map} +1 -1
- package/dist/esm/scripts/{reprocessJob-7.js → reprocessJob-8.js} +23 -13
- package/dist/esm/scripts/reprocessJob-8.js.map +1 -0
- package/dist/esm/scripts/retryJob-11.js +42 -14
- package/dist/esm/scripts/retryJob-11.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/dist/cjs/scripts/addPrioritizedJob-7.js.map +0 -1
- package/dist/cjs/scripts/addStandardJob-7.js.map +0 -1
- package/dist/cjs/scripts/changePriority-6.js.map +0 -1
- package/dist/cjs/scripts/moveJobsToWait-7.js.map +0 -1
- package/dist/cjs/scripts/promote-8.js.map +0 -1
- package/dist/cjs/scripts/reprocessJob-7.js.map +0 -1
- package/dist/esm/scripts/addPrioritizedJob-7.js.map +0 -1
- package/dist/esm/scripts/addStandardJob-7.js.map +0 -1
- package/dist/esm/scripts/changePriority-6.js.map +0 -1
- package/dist/esm/scripts/moveJobsToWait-7.js.map +0 -1
- package/dist/esm/scripts/promote-8.js.map +0 -1
- package/dist/esm/scripts/reprocessJob-7.js.map +0 -1
- /package/dist/esm/scripts/{addPrioritizedJob-7.d.ts → addPrioritizedJob-8.d.ts} +0 -0
- /package/dist/esm/scripts/{addStandardJob-7.d.ts → addStandardJob-8.d.ts} +0 -0
- /package/dist/esm/scripts/{changePriority-6.d.ts → changePriority-7.d.ts} +0 -0
- /package/dist/esm/scripts/{moveJobsToWait-7.d.ts → moveJobsToWait-8.d.ts} +0 -0
- /package/dist/esm/scripts/{promote-8.d.ts → promote-9.d.ts} +0 -0
- /package/dist/esm/scripts/{removeJob-1.d.ts → removeJob-2.d.ts} +0 -0
- /package/dist/esm/scripts/{reprocessJob-7.d.ts → reprocessJob-8.d.ts} +0 -0
@@ -142,11 +142,11 @@ if (#stalling > 0) then
|
|
142
142
|
|
143
143
|
table.insert(failed, jobId)
|
144
144
|
else
|
145
|
-
local target,
|
146
|
-
getTargetQueueList(metaKey, waitKey, pausedKey)
|
145
|
+
local target, isPausedOrMaxed=
|
146
|
+
getTargetQueueList(metaKey, activeKey, waitKey, pausedKey)
|
147
147
|
|
148
148
|
-- Move the job back to the wait queue, to immediately be picked up by a waiting worker.
|
149
|
-
addJobInTargetList(target, markerKey, "RPUSH",
|
149
|
+
addJobInTargetList(target, markerKey, "RPUSH", isPausedOrMaxed, jobId)
|
150
150
|
|
151
151
|
rcall("XADD", eventStreamKey, "*", "event",
|
152
152
|
"waiting", "jobId", jobId, 'prev', 'active')
|
@@ -50,12 +50,12 @@ local opts = cmsgpack.unpack(ARGV[3])
|
|
50
50
|
--- @include "includes/prepareJobForProcessing"
|
51
51
|
--- @include "includes/promoteDelayedJobs"
|
52
52
|
|
53
|
-
local target,
|
53
|
+
local target, isPausedOrMaxed = getTargetQueueList(KEYS[9], activeKey, waitKey, KEYS[8])
|
54
54
|
|
55
55
|
-- Check if there are delayed jobs that we can move to wait.
|
56
56
|
local markerKey = KEYS[11]
|
57
57
|
promoteDelayedJobs(delayedKey, markerKey, target, KEYS[3], eventStreamKey, ARGV[1],
|
58
|
-
ARGV[2], KEYS[10],
|
58
|
+
ARGV[2], KEYS[10], isPausedOrMaxed)
|
59
59
|
|
60
60
|
local maxJobs = tonumber(opts['limiter'] and opts['limiter']['max'])
|
61
61
|
local expireTime = getRateLimitTTL(maxJobs, rateLimiterKey)
|
@@ -63,8 +63,8 @@ local expireTime = getRateLimitTTL(maxJobs, rateLimiterKey)
|
|
63
63
|
-- Check if we are rate limited first.
|
64
64
|
if expireTime > 0 then return {0, 0, expireTime, 0} end
|
65
65
|
|
66
|
-
-- paused queue
|
67
|
-
if
|
66
|
+
-- paused or maxed queue
|
67
|
+
if isPausedOrMaxed then return {0, 0, 0, 0} end
|
68
68
|
|
69
69
|
-- no job ID, try non-blocking move from wait to active
|
70
70
|
local jobId = rcall("RPOPLPUSH", waitKey, activeKey)
|
@@ -202,11 +202,11 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
|
|
202
202
|
-- and not rate limited.
|
203
203
|
if (ARGV[6] == "1") then
|
204
204
|
|
205
|
-
local target,
|
205
|
+
local target, isPausedOrMaxed = getTargetQueueList(metaKey, KEYS[2], KEYS[1], KEYS[8])
|
206
206
|
|
207
207
|
-- Check if there are delayed jobs that can be promoted
|
208
208
|
promoteDelayedJobs(KEYS[7], KEYS[14], target, KEYS[3], eventStreamKey, ARGV[7],
|
209
|
-
timestamp, KEYS[10],
|
209
|
+
timestamp, KEYS[10], isPausedOrMaxed)
|
210
210
|
|
211
211
|
local maxJobs = tonumber(opts['limiter'] and opts['limiter']['max'])
|
212
212
|
-- Check if we are rate limited first.
|
@@ -214,8 +214,8 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
|
|
214
214
|
|
215
215
|
if expireTime > 0 then return {0, 0, expireTime, 0} end
|
216
216
|
|
217
|
-
-- paused queue
|
218
|
-
if
|
217
|
+
-- paused or maxed queue
|
218
|
+
if isPausedOrMaxed then return {0, 0, 0, 0} end
|
219
219
|
|
220
220
|
jobId = rcall("RPOPLPUSH", KEYS[1], KEYS[2])
|
221
221
|
|
@@ -21,8 +21,9 @@
|
|
21
21
|
-3 - Job not in active set
|
22
22
|
]]
|
23
23
|
local rcall = redis.call
|
24
|
+
local stalledKey = KEYS[5]
|
24
25
|
|
25
|
-
|
26
|
+
--- Includes
|
26
27
|
--- @include "includes/removeLock"
|
27
28
|
|
28
29
|
local function moveToWaitingChildren (activeKey, waitingChildrenKey, jobId,
|
@@ -43,7 +44,7 @@ end
|
|
43
44
|
if rcall("EXISTS", KEYS[4]) == 1 then
|
44
45
|
if ARGV[2] ~= "" then
|
45
46
|
if rcall("SISMEMBER", KEYS[4] .. ":dependencies", ARGV[2]) ~= 0 then
|
46
|
-
local errorCode = removeLock(KEYS[4],
|
47
|
+
local errorCode = removeLock(KEYS[4], stalledKey, ARGV[1], ARGV[4])
|
47
48
|
if errorCode < 0 then
|
48
49
|
return errorCode
|
49
50
|
end
|
@@ -53,7 +54,7 @@ if rcall("EXISTS", KEYS[4]) == 1 then
|
|
53
54
|
return 1
|
54
55
|
else
|
55
56
|
if rcall("SCARD", KEYS[4] .. ":dependencies") ~= 0 then
|
56
|
-
local errorCode = removeLock(KEYS[4],
|
57
|
+
local errorCode = removeLock(KEYS[4], stalledKey, ARGV[1], ARGV[4])
|
57
58
|
if errorCode < 0 then
|
58
59
|
return errorCode
|
59
60
|
end
|
@@ -7,9 +7,10 @@
|
|
7
7
|
KEYS[3] 'paused'
|
8
8
|
KEYS[4] 'meta'
|
9
9
|
KEYS[5] 'prioritized'
|
10
|
-
KEYS[6] '
|
11
|
-
KEYS[7] '
|
12
|
-
KEYS[8] '
|
10
|
+
KEYS[6] 'active'
|
11
|
+
KEYS[7] 'pc' priority counter
|
12
|
+
KEYS[8] 'event stream'
|
13
|
+
KEYS[9] 'marker'
|
13
14
|
|
14
15
|
ARGV[1] queue.toKey('')
|
15
16
|
ARGV[2] jobId
|
@@ -33,23 +34,24 @@ if rcall("ZREM", KEYS[1], jobId) == 1 then
|
|
33
34
|
local jobKey = ARGV[1] .. jobId
|
34
35
|
local priority = tonumber(rcall("HGET", jobKey, "priority")) or 0
|
35
36
|
local metaKey = KEYS[4]
|
37
|
+
local markerKey = KEYS[9]
|
36
38
|
|
37
39
|
-- Remove delayed "marker" from the wait list if there is any.
|
38
40
|
-- Since we are adding a job we do not need the marker anymore.
|
39
41
|
-- Markers in waitlist DEPRECATED in v5: Remove in v6.
|
40
|
-
local target,
|
42
|
+
local target, isPausedOrMaxed = getTargetQueueList(metaKey, KEYS[6], KEYS[2], KEYS[3])
|
41
43
|
local marker = rcall("LINDEX", target, 0)
|
42
44
|
if marker and string.sub(marker, 1, 2) == "0:" then rcall("LPOP", target) end
|
43
45
|
|
44
46
|
if priority == 0 then
|
45
47
|
-- LIFO or FIFO
|
46
|
-
addJobInTargetList(target,
|
48
|
+
addJobInTargetList(target, markerKey, "LPUSH", isPausedOrMaxed, jobId)
|
47
49
|
else
|
48
|
-
addJobWithPriority(
|
50
|
+
addJobWithPriority(markerKey, KEYS[5], priority, jobId, KEYS[7], isPausedOrMaxed)
|
49
51
|
end
|
50
52
|
|
51
53
|
-- Emit waiting event (wait..ing@token)
|
52
|
-
rcall("XADD", KEYS[
|
54
|
+
rcall("XADD", KEYS[8], "*", "event", "waiting", "jobId", jobId, "prev",
|
53
55
|
"delayed");
|
54
56
|
|
55
57
|
rcall("HSET", jobKey, "delay", 0)
|
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
Input:
|
6
6
|
KEYS[1] queue prefix
|
7
|
+
KEYS[2] meta key
|
7
8
|
|
8
9
|
ARGV[1] jobId
|
9
10
|
ARGV[2] remove children
|
@@ -66,7 +67,7 @@ local function removeJob( prefix, jobId, parentKey, removeChildren)
|
|
66
67
|
local prev = removeJobFromAnyState(prefix, jobId)
|
67
68
|
|
68
69
|
if removeJobKeys(jobKey) > 0 then
|
69
|
-
local maxEvents = getOrSetMaxEvents(
|
70
|
+
local maxEvents = getOrSetMaxEvents(KEYS[2])
|
70
71
|
rcall("XADD", prefix .. "events", "MAXLEN", "~", maxEvents, "*", "event", "removed",
|
71
72
|
"jobId", jobId, "prev", prev)
|
72
73
|
end
|
@@ -8,7 +8,8 @@
|
|
8
8
|
KEYS[4] wait key
|
9
9
|
KEYS[5] meta
|
10
10
|
KEYS[6] paused key
|
11
|
-
KEYS[7]
|
11
|
+
KEYS[7] active key
|
12
|
+
KEYS[8] marker key
|
12
13
|
|
13
14
|
ARGV[1] job.id
|
14
15
|
ARGV[2] (job.opts.lifo ? 'R' : 'L') + 'PUSH'
|
@@ -32,8 +33,8 @@ if rcall("EXISTS", KEYS[1]) == 1 then
|
|
32
33
|
if (rcall("ZREM", KEYS[3], jobId) == 1) then
|
33
34
|
rcall("HDEL", KEYS[1], "finishedOn", "processedOn", ARGV[3])
|
34
35
|
|
35
|
-
local target,
|
36
|
-
addJobInTargetList(target, KEYS[
|
36
|
+
local target, isPausedOrMaxed = getTargetQueueList(KEYS[5], KEYS[7], KEYS[4], KEYS[6])
|
37
|
+
addJobInTargetList(target, KEYS[8], ARGV[2], isPausedOrMaxed, jobId)
|
37
38
|
|
38
39
|
local maxEvents = getOrSetMaxEvents(KEYS[5])
|
39
40
|
-- Emit waiting event
|
@@ -38,13 +38,14 @@ local rcall = redis.call
|
|
38
38
|
--- @include "includes/getTargetQueueList"
|
39
39
|
--- @include "includes/promoteDelayedJobs"
|
40
40
|
--- @include "includes/removeLock"
|
41
|
+
--- @include "includes/isQueuePausedOrMaxed"
|
41
42
|
|
42
|
-
local target,
|
43
|
+
local target, isPausedOrMaxed = getTargetQueueList(KEYS[5], KEYS[1], KEYS[2], KEYS[3])
|
43
44
|
local markerKey = KEYS[10]
|
44
45
|
|
45
46
|
-- Check if there are delayed jobs that we can move to wait.
|
46
47
|
-- test example: when there are delayed jobs between retries
|
47
|
-
promoteDelayedJobs(KEYS[7], markerKey, target, KEYS[8], KEYS[6], ARGV[1], ARGV[2], KEYS[9],
|
48
|
+
promoteDelayedJobs(KEYS[7], markerKey, target, KEYS[8], KEYS[6], ARGV[1], ARGV[2], KEYS[9], isPausedOrMaxed)
|
48
49
|
|
49
50
|
if rcall("EXISTS", KEYS[4]) == 1 then
|
50
51
|
local errorCode = removeLock(KEYS[4], KEYS[11], ARGV[5], ARGV[4])
|
@@ -57,11 +58,14 @@ if rcall("EXISTS", KEYS[4]) == 1 then
|
|
57
58
|
|
58
59
|
local priority = tonumber(rcall("HGET", KEYS[4], "priority")) or 0
|
59
60
|
|
61
|
+
--need to re-evaluate after removing job from active
|
62
|
+
isPausedOrMaxed = isQueuePausedOrMaxed(KEYS[5], KEYS[1])
|
63
|
+
|
60
64
|
-- Standard or priority add
|
61
65
|
if priority == 0 then
|
62
|
-
addJobInTargetList(target,
|
66
|
+
addJobInTargetList(target, markerKey, ARGV[3], isPausedOrMaxed, ARGV[4])
|
63
67
|
else
|
64
|
-
addJobWithPriority(markerKey, KEYS[8], priority, ARGV[4], KEYS[9],
|
68
|
+
addJobWithPriority(markerKey, KEYS[8], priority, ARGV[4], KEYS[9], isPausedOrMaxed)
|
65
69
|
end
|
66
70
|
|
67
71
|
rcall("HINCRBY", KEYS[4], "atm", 1)
|
@@ -128,42 +128,61 @@ end
|
|
128
128
|
--[[
|
129
129
|
Add marker if needed when a job is available.
|
130
130
|
]]
|
131
|
-
local function addBaseMarkerIfNeeded(markerKey,
|
132
|
-
if not
|
131
|
+
local function addBaseMarkerIfNeeded(markerKey, isPausedOrMaxed)
|
132
|
+
if not isPausedOrMaxed then
|
133
133
|
rcall("ZADD", markerKey, 0, "0")
|
134
134
|
end
|
135
135
|
end
|
136
|
-
local function addJobInTargetList(targetKey, markerKey, pushCmd,
|
136
|
+
local function addJobInTargetList(targetKey, markerKey, pushCmd, isPausedOrMaxed, jobId)
|
137
137
|
rcall(pushCmd, targetKey, jobId)
|
138
|
-
addBaseMarkerIfNeeded(markerKey,
|
138
|
+
addBaseMarkerIfNeeded(markerKey, isPausedOrMaxed)
|
139
139
|
end
|
140
140
|
--[[
|
141
141
|
Function to add job considering priority.
|
142
142
|
]]
|
143
143
|
-- Includes
|
144
|
-
local function addJobWithPriority(markerKey, prioritizedKey, priority, jobId, priorityCounterKey,
|
144
|
+
local function addJobWithPriority(markerKey, prioritizedKey, priority, jobId, priorityCounterKey,
|
145
|
+
isPausedOrMaxed)
|
145
146
|
local prioCounter = rcall("INCR", priorityCounterKey)
|
146
147
|
local score = priority * 0x100000000 + prioCounter % 0x100000000
|
147
148
|
rcall("ZADD", prioritizedKey, score, jobId)
|
148
|
-
addBaseMarkerIfNeeded(markerKey,
|
149
|
+
addBaseMarkerIfNeeded(markerKey, isPausedOrMaxed)
|
149
150
|
end
|
150
151
|
--[[
|
151
|
-
Function to check
|
152
|
+
Function to check if queue is paused or maxed
|
152
153
|
(since an empty list and !EXISTS are not really the same).
|
153
154
|
]]
|
154
|
-
local function
|
155
|
-
|
155
|
+
local function isQueuePausedOrMaxed(queueMetaKey, activeKey)
|
156
|
+
local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
|
157
|
+
if queueAttributes[1] then
|
158
|
+
return true
|
159
|
+
else
|
160
|
+
if queueAttributes[2] then
|
161
|
+
local activeCount = rcall("LLEN", activeKey)
|
162
|
+
return activeCount >= tonumber(queueAttributes[2])
|
163
|
+
end
|
164
|
+
end
|
165
|
+
return false
|
156
166
|
end
|
157
167
|
--[[
|
158
168
|
Function to check for the meta.paused key to decide if we are paused or not
|
159
169
|
(since an empty list and !EXISTS are not really the same).
|
160
170
|
]]
|
161
|
-
local function getTargetQueueList(queueMetaKey, waitKey, pausedKey)
|
162
|
-
|
163
|
-
|
164
|
-
else
|
171
|
+
local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
|
172
|
+
local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
|
173
|
+
if queueAttributes[1] then
|
165
174
|
return pausedKey, true
|
175
|
+
else
|
176
|
+
if queueAttributes[2] then
|
177
|
+
local activeCount = rcall("LLEN", activeKey)
|
178
|
+
if activeCount >= tonumber(queueAttributes[2]) then
|
179
|
+
return waitKey, true
|
180
|
+
else
|
181
|
+
return waitKey, false
|
182
|
+
end
|
183
|
+
end
|
166
184
|
end
|
185
|
+
return waitKey, false
|
167
186
|
end
|
168
187
|
local function moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey,
|
169
188
|
parentKey, parentId, timestamp)
|
@@ -173,6 +192,7 @@ local function moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey,
|
|
173
192
|
rcall("ZREM", parentQueueKey .. ":waiting-children", parentId)
|
174
193
|
local parentWaitKey = parentQueueKey .. ":wait"
|
175
194
|
local parentPausedKey = parentQueueKey .. ":paused"
|
195
|
+
local parentActiveKey = parentQueueKey .. ":active"
|
176
196
|
local parentMetaKey = parentQueueKey .. ":meta"
|
177
197
|
local parentMarkerKey = parentQueueKey .. ":marker"
|
178
198
|
local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
|
@@ -188,15 +208,16 @@ local function moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey,
|
|
188
208
|
addDelayMarkerIfNeeded(parentMarkerKey, parentDelayedKey)
|
189
209
|
else
|
190
210
|
if priority == 0 then
|
191
|
-
local parentTarget,
|
192
|
-
getTargetQueueList(parentMetaKey, parentWaitKey,
|
211
|
+
local parentTarget, isParentPausedOrMaxed =
|
212
|
+
getTargetQueueList(parentMetaKey, parentActiveKey, parentWaitKey,
|
193
213
|
parentPausedKey)
|
194
|
-
addJobInTargetList(parentTarget, parentMarkerKey, "RPUSH",
|
214
|
+
addJobInTargetList(parentTarget, parentMarkerKey, "RPUSH", isParentPausedOrMaxed,
|
215
|
+
parentId)
|
195
216
|
else
|
196
|
-
local
|
217
|
+
local isPausedOrMaxed = isQueuePausedOrMaxed(parentMetaKey, parentActiveKey)
|
197
218
|
addJobWithPriority(parentMarkerKey,
|
198
219
|
parentQueueKey .. ":prioritized", priority,
|
199
|
-
parentId, parentQueueKey .. ":pc",
|
220
|
+
parentId, parentQueueKey .. ":pc", isPausedOrMaxed)
|
200
221
|
end
|
201
222
|
rcall("XADD", parentQueueKey .. ":events", "*", "event", "waiting",
|
202
223
|
"jobId", parentId, "prev", "waiting-children")
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"addDelayedJob-6.js","sourceRoot":"","sources":["../../../src/scripts/addDelayedJob-6.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"addDelayedJob-6.js","sourceRoot":"","sources":["../../../src/scripts/addDelayedJob-6.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwUf,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,eAAe;IACrB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -100,42 +100,61 @@ end
|
|
100
100
|
--[[
|
101
101
|
Add marker if needed when a job is available.
|
102
102
|
]]
|
103
|
-
local function addBaseMarkerIfNeeded(markerKey,
|
104
|
-
if not
|
103
|
+
local function addBaseMarkerIfNeeded(markerKey, isPausedOrMaxed)
|
104
|
+
if not isPausedOrMaxed then
|
105
105
|
rcall("ZADD", markerKey, 0, "0")
|
106
106
|
end
|
107
107
|
end
|
108
|
-
local function addJobInTargetList(targetKey, markerKey, pushCmd,
|
108
|
+
local function addJobInTargetList(targetKey, markerKey, pushCmd, isPausedOrMaxed, jobId)
|
109
109
|
rcall(pushCmd, targetKey, jobId)
|
110
|
-
addBaseMarkerIfNeeded(markerKey,
|
110
|
+
addBaseMarkerIfNeeded(markerKey, isPausedOrMaxed)
|
111
111
|
end
|
112
112
|
--[[
|
113
113
|
Function to add job considering priority.
|
114
114
|
]]
|
115
115
|
-- Includes
|
116
|
-
local function addJobWithPriority(markerKey, prioritizedKey, priority, jobId, priorityCounterKey,
|
116
|
+
local function addJobWithPriority(markerKey, prioritizedKey, priority, jobId, priorityCounterKey,
|
117
|
+
isPausedOrMaxed)
|
117
118
|
local prioCounter = rcall("INCR", priorityCounterKey)
|
118
119
|
local score = priority * 0x100000000 + prioCounter % 0x100000000
|
119
120
|
rcall("ZADD", prioritizedKey, score, jobId)
|
120
|
-
addBaseMarkerIfNeeded(markerKey,
|
121
|
+
addBaseMarkerIfNeeded(markerKey, isPausedOrMaxed)
|
121
122
|
end
|
122
123
|
--[[
|
123
|
-
Function to check
|
124
|
+
Function to check if queue is paused or maxed
|
124
125
|
(since an empty list and !EXISTS are not really the same).
|
125
126
|
]]
|
126
|
-
local function
|
127
|
-
|
127
|
+
local function isQueuePausedOrMaxed(queueMetaKey, activeKey)
|
128
|
+
local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
|
129
|
+
if queueAttributes[1] then
|
130
|
+
return true
|
131
|
+
else
|
132
|
+
if queueAttributes[2] then
|
133
|
+
local activeCount = rcall("LLEN", activeKey)
|
134
|
+
return activeCount >= tonumber(queueAttributes[2])
|
135
|
+
end
|
136
|
+
end
|
137
|
+
return false
|
128
138
|
end
|
129
139
|
--[[
|
130
140
|
Function to check for the meta.paused key to decide if we are paused or not
|
131
141
|
(since an empty list and !EXISTS are not really the same).
|
132
142
|
]]
|
133
|
-
local function getTargetQueueList(queueMetaKey, waitKey, pausedKey)
|
134
|
-
|
135
|
-
|
136
|
-
else
|
143
|
+
local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
|
144
|
+
local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
|
145
|
+
if queueAttributes[1] then
|
137
146
|
return pausedKey, true
|
147
|
+
else
|
148
|
+
if queueAttributes[2] then
|
149
|
+
local activeCount = rcall("LLEN", activeKey)
|
150
|
+
if activeCount >= tonumber(queueAttributes[2]) then
|
151
|
+
return waitKey, true
|
152
|
+
else
|
153
|
+
return waitKey, false
|
154
|
+
end
|
155
|
+
end
|
138
156
|
end
|
157
|
+
return waitKey, false
|
139
158
|
end
|
140
159
|
local function moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey,
|
141
160
|
parentKey, parentId, timestamp)
|
@@ -145,6 +164,7 @@ local function moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey,
|
|
145
164
|
rcall("ZREM", parentQueueKey .. ":waiting-children", parentId)
|
146
165
|
local parentWaitKey = parentQueueKey .. ":wait"
|
147
166
|
local parentPausedKey = parentQueueKey .. ":paused"
|
167
|
+
local parentActiveKey = parentQueueKey .. ":active"
|
148
168
|
local parentMetaKey = parentQueueKey .. ":meta"
|
149
169
|
local parentMarkerKey = parentQueueKey .. ":marker"
|
150
170
|
local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
|
@@ -160,15 +180,16 @@ local function moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey,
|
|
160
180
|
addDelayMarkerIfNeeded(parentMarkerKey, parentDelayedKey)
|
161
181
|
else
|
162
182
|
if priority == 0 then
|
163
|
-
local parentTarget,
|
164
|
-
getTargetQueueList(parentMetaKey, parentWaitKey,
|
183
|
+
local parentTarget, isParentPausedOrMaxed =
|
184
|
+
getTargetQueueList(parentMetaKey, parentActiveKey, parentWaitKey,
|
165
185
|
parentPausedKey)
|
166
|
-
addJobInTargetList(parentTarget, parentMarkerKey, "RPUSH",
|
186
|
+
addJobInTargetList(parentTarget, parentMarkerKey, "RPUSH", isParentPausedOrMaxed,
|
187
|
+
parentId)
|
167
188
|
else
|
168
|
-
local
|
189
|
+
local isPausedOrMaxed = isQueuePausedOrMaxed(parentMetaKey, parentActiveKey)
|
169
190
|
addJobWithPriority(parentMarkerKey,
|
170
191
|
parentQueueKey .. ":prioritized", priority,
|
171
|
-
parentId, parentQueueKey .. ":pc",
|
192
|
+
parentId, parentQueueKey .. ":pc", isPausedOrMaxed)
|
172
193
|
end
|
173
194
|
rcall("XADD", parentQueueKey .. ":events", "*", "event", "waiting",
|
174
195
|
"jobId", parentId, "prev", "waiting-children")
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"addParentJob-4.js","sourceRoot":"","sources":["../../../src/scripts/addParentJob-4.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"addParentJob-4.js","sourceRoot":"","sources":["../../../src/scripts/addParentJob-4.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuSf,CAAC;AACF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,cAAc;IACpB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -9,8 +9,9 @@ const content = `--[[
|
|
9
9
|
KEYS[3] 'id'
|
10
10
|
KEYS[4] 'prioritized'
|
11
11
|
KEYS[5] 'completed'
|
12
|
-
KEYS[6]
|
13
|
-
KEYS[7]
|
12
|
+
KEYS[6] 'active'
|
13
|
+
KEYS[7] events stream key
|
14
|
+
KEYS[8] 'pc' priority counter
|
14
15
|
ARGV[1] msgpacked arguments array
|
15
16
|
[1] key prefix,
|
16
17
|
[2] custom id (will not generate one automatically)
|
@@ -31,8 +32,9 @@ local metaKey = KEYS[2]
|
|
31
32
|
local idKey = KEYS[3]
|
32
33
|
local priorityKey = KEYS[4]
|
33
34
|
local completedKey = KEYS[5]
|
34
|
-
local
|
35
|
-
local
|
35
|
+
local activeKey = KEYS[6]
|
36
|
+
local eventsKey = KEYS[7]
|
37
|
+
local priorityCounterKey = KEYS[8]
|
36
38
|
local jobId
|
37
39
|
local jobIdKey
|
38
40
|
local rcall = redis.call
|
@@ -51,16 +53,17 @@ local parentData
|
|
51
53
|
--[[
|
52
54
|
Add marker if needed when a job is available.
|
53
55
|
]]
|
54
|
-
local function addBaseMarkerIfNeeded(markerKey,
|
55
|
-
if not
|
56
|
+
local function addBaseMarkerIfNeeded(markerKey, isPausedOrMaxed)
|
57
|
+
if not isPausedOrMaxed then
|
56
58
|
rcall("ZADD", markerKey, 0, "0")
|
57
59
|
end
|
58
60
|
end
|
59
|
-
local function addJobWithPriority(markerKey, prioritizedKey, priority, jobId, priorityCounterKey,
|
61
|
+
local function addJobWithPriority(markerKey, prioritizedKey, priority, jobId, priorityCounterKey,
|
62
|
+
isPausedOrMaxed)
|
60
63
|
local prioCounter = rcall("INCR", priorityCounterKey)
|
61
64
|
local score = priority * 0x100000000 + prioCounter % 0x100000000
|
62
65
|
rcall("ZADD", prioritizedKey, score, jobId)
|
63
|
-
addBaseMarkerIfNeeded(markerKey,
|
66
|
+
addBaseMarkerIfNeeded(markerKey, isPausedOrMaxed)
|
64
67
|
end
|
65
68
|
--[[
|
66
69
|
Function to store a job
|
@@ -145,27 +148,45 @@ end
|
|
145
148
|
Function to add job in target list and add marker if needed.
|
146
149
|
]]
|
147
150
|
-- Includes
|
148
|
-
local function addJobInTargetList(targetKey, markerKey, pushCmd,
|
151
|
+
local function addJobInTargetList(targetKey, markerKey, pushCmd, isPausedOrMaxed, jobId)
|
149
152
|
rcall(pushCmd, targetKey, jobId)
|
150
|
-
addBaseMarkerIfNeeded(markerKey,
|
153
|
+
addBaseMarkerIfNeeded(markerKey, isPausedOrMaxed)
|
151
154
|
end
|
152
155
|
--[[
|
153
|
-
Function to check
|
156
|
+
Function to check if queue is paused or maxed
|
154
157
|
(since an empty list and !EXISTS are not really the same).
|
155
158
|
]]
|
156
|
-
local function
|
157
|
-
|
159
|
+
local function isQueuePausedOrMaxed(queueMetaKey, activeKey)
|
160
|
+
local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
|
161
|
+
if queueAttributes[1] then
|
162
|
+
return true
|
163
|
+
else
|
164
|
+
if queueAttributes[2] then
|
165
|
+
local activeCount = rcall("LLEN", activeKey)
|
166
|
+
return activeCount >= tonumber(queueAttributes[2])
|
167
|
+
end
|
168
|
+
end
|
169
|
+
return false
|
158
170
|
end
|
159
171
|
--[[
|
160
172
|
Function to check for the meta.paused key to decide if we are paused or not
|
161
173
|
(since an empty list and !EXISTS are not really the same).
|
162
174
|
]]
|
163
|
-
local function getTargetQueueList(queueMetaKey, waitKey, pausedKey)
|
164
|
-
|
165
|
-
|
166
|
-
else
|
175
|
+
local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
|
176
|
+
local queueAttributes = rcall("HMGET", queueMetaKey, "paused", "concurrency")
|
177
|
+
if queueAttributes[1] then
|
167
178
|
return pausedKey, true
|
179
|
+
else
|
180
|
+
if queueAttributes[2] then
|
181
|
+
local activeCount = rcall("LLEN", activeKey)
|
182
|
+
if activeCount >= tonumber(queueAttributes[2]) then
|
183
|
+
return waitKey, true
|
184
|
+
else
|
185
|
+
return waitKey, false
|
186
|
+
end
|
187
|
+
end
|
168
188
|
end
|
189
|
+
return waitKey, false
|
169
190
|
end
|
170
191
|
local function moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey,
|
171
192
|
parentKey, parentId, timestamp)
|
@@ -175,6 +196,7 @@ local function moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey,
|
|
175
196
|
rcall("ZREM", parentQueueKey .. ":waiting-children", parentId)
|
176
197
|
local parentWaitKey = parentQueueKey .. ":wait"
|
177
198
|
local parentPausedKey = parentQueueKey .. ":paused"
|
199
|
+
local parentActiveKey = parentQueueKey .. ":active"
|
178
200
|
local parentMetaKey = parentQueueKey .. ":meta"
|
179
201
|
local parentMarkerKey = parentQueueKey .. ":marker"
|
180
202
|
local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
|
@@ -190,15 +212,16 @@ local function moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey,
|
|
190
212
|
addDelayMarkerIfNeeded(parentMarkerKey, parentDelayedKey)
|
191
213
|
else
|
192
214
|
if priority == 0 then
|
193
|
-
local parentTarget,
|
194
|
-
getTargetQueueList(parentMetaKey, parentWaitKey,
|
215
|
+
local parentTarget, isParentPausedOrMaxed =
|
216
|
+
getTargetQueueList(parentMetaKey, parentActiveKey, parentWaitKey,
|
195
217
|
parentPausedKey)
|
196
|
-
addJobInTargetList(parentTarget, parentMarkerKey, "RPUSH",
|
218
|
+
addJobInTargetList(parentTarget, parentMarkerKey, "RPUSH", isParentPausedOrMaxed,
|
219
|
+
parentId)
|
197
220
|
else
|
198
|
-
local
|
221
|
+
local isPausedOrMaxed = isQueuePausedOrMaxed(parentMetaKey, parentActiveKey)
|
199
222
|
addJobWithPriority(parentMarkerKey,
|
200
223
|
parentQueueKey .. ":prioritized", priority,
|
201
|
-
parentId, parentQueueKey .. ":pc",
|
224
|
+
parentId, parentQueueKey .. ":pc", isPausedOrMaxed)
|
202
225
|
end
|
203
226
|
rcall("XADD", parentQueueKey .. ":events", "*", "event", "waiting",
|
204
227
|
"jobId", parentId, "prev", "waiting-children")
|
@@ -270,8 +293,8 @@ local delay, priority = storeJob(eventsKey, jobIdKey, jobId, args[3], ARGV[2],
|
|
270
293
|
opts, timestamp, parentKey, parentData,
|
271
294
|
repeatJobKey)
|
272
295
|
-- Add the job to the prioritized set
|
273
|
-
local
|
274
|
-
addJobWithPriority( KEYS[1], priorityKey, priority, jobId, priorityCounterKey,
|
296
|
+
local isPausedOrMaxed = isQueuePausedOrMaxed(metaKey, activeKey)
|
297
|
+
addJobWithPriority( KEYS[1], priorityKey, priority, jobId, priorityCounterKey, isPausedOrMaxed)
|
275
298
|
-- Emit waiting event
|
276
299
|
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "waiting",
|
277
300
|
"jobId", jobId)
|
@@ -284,6 +307,6 @@ return jobId .. "" -- convert to string
|
|
284
307
|
export const addPrioritizedJob = {
|
285
308
|
name: 'addPrioritizedJob',
|
286
309
|
content,
|
287
|
-
keys:
|
310
|
+
keys: 8,
|
288
311
|
};
|
289
|
-
//# sourceMappingURL=addPrioritizedJob-
|
312
|
+
//# sourceMappingURL=addPrioritizedJob-8.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"addPrioritizedJob-8.js","sourceRoot":"","sources":["../../../src/scripts/addPrioritizedJob-8.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiTf,CAAC;AACF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,mBAAmB;IACzB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|