bullmq 5.41.9 → 5.43.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/job-scheduler.js +3 -0
- package/dist/cjs/classes/job-scheduler.js.map +1 -1
- package/dist/cjs/classes/job.js +35 -36
- package/dist/cjs/classes/job.js.map +1 -1
- package/dist/cjs/classes/scripts.js +22 -1
- package/dist/cjs/classes/scripts.js.map +1 -1
- package/dist/cjs/classes/worker.js +4 -8
- package/dist/cjs/classes/worker.js.map +1 -1
- package/dist/cjs/commands/getDependencyCounts-4.lua +31 -0
- package/dist/cjs/commands/includes/moveParentFromWaitingChildrenToFailed.lua +11 -1
- package/dist/cjs/commands/includes/removeJobKeys.lua +2 -2
- package/dist/cjs/commands/includes/storeJobScheduler.lua +1 -1
- package/dist/cjs/commands/moveStalledJobsToWait-9.lua +5 -0
- package/dist/cjs/commands/moveToFinished-14.lua +2 -0
- package/dist/cjs/commands/moveToWaitingChildren-8.lua +133 -0
- package/dist/cjs/commands/removeJob-3.lua +10 -0
- package/dist/cjs/scripts/addJobScheduler-10.js +3 -3
- package/dist/cjs/scripts/addRepeatableJob-2.js +2 -2
- package/dist/cjs/scripts/cleanJobsInSet-3.js +2 -2
- package/dist/cjs/scripts/drain-5.js +2 -2
- package/dist/cjs/scripts/getDependencyCounts-4.js +37 -0
- package/dist/cjs/scripts/getDependencyCounts-4.js.map +1 -0
- package/dist/cjs/scripts/index.js +2 -1
- package/dist/cjs/scripts/index.js.map +1 -1
- package/dist/cjs/scripts/moveStalledJobsToWait-9.js +17 -3
- package/dist/cjs/scripts/moveStalledJobsToWait-9.js.map +1 -1
- package/dist/cjs/scripts/moveToFinished-14.js +14 -3
- package/dist/cjs/scripts/moveToFinished-14.js.map +1 -1
- package/dist/cjs/scripts/moveToWaitingChildren-8.js +549 -0
- package/dist/cjs/scripts/moveToWaitingChildren-8.js.map +1 -0
- package/dist/cjs/scripts/obliterate-2.js +2 -2
- package/dist/cjs/scripts/removeChildDependency-1.js +2 -2
- package/dist/cjs/scripts/removeJob-3.js +10 -2
- package/dist/cjs/scripts/removeJob-3.js.map +1 -1
- package/dist/cjs/scripts/removeJobScheduler-3.js +2 -2
- package/dist/cjs/scripts/removeRepeatable-3.js +2 -2
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/classes/job-scheduler.js +3 -0
- package/dist/esm/classes/job-scheduler.js.map +1 -1
- package/dist/esm/classes/job.d.ts +5 -1
- package/dist/esm/classes/job.js +35 -36
- package/dist/esm/classes/job.js.map +1 -1
- package/dist/esm/classes/scripts.d.ts +2 -0
- package/dist/esm/classes/scripts.js +22 -1
- package/dist/esm/classes/scripts.js.map +1 -1
- package/dist/esm/classes/worker.js +4 -8
- package/dist/esm/classes/worker.js.map +1 -1
- package/dist/esm/commands/getDependencyCounts-4.lua +31 -0
- package/dist/esm/commands/includes/moveParentFromWaitingChildrenToFailed.lua +11 -1
- package/dist/esm/commands/includes/removeJobKeys.lua +2 -2
- package/dist/esm/commands/includes/storeJobScheduler.lua +1 -1
- package/dist/esm/commands/moveStalledJobsToWait-9.lua +5 -0
- package/dist/esm/commands/moveToFinished-14.lua +2 -0
- package/dist/esm/commands/moveToWaitingChildren-8.lua +133 -0
- package/dist/esm/commands/removeJob-3.lua +10 -0
- package/dist/esm/scripts/addJobScheduler-10.js +3 -3
- package/dist/esm/scripts/addRepeatableJob-2.js +2 -2
- package/dist/esm/scripts/cleanJobsInSet-3.js +2 -2
- package/dist/esm/scripts/drain-5.js +2 -2
- package/dist/esm/scripts/getDependencyCounts-4.d.ts +5 -0
- package/dist/esm/scripts/getDependencyCounts-4.js +34 -0
- package/dist/esm/scripts/getDependencyCounts-4.js.map +1 -0
- package/dist/esm/scripts/index.d.ts +2 -1
- package/dist/esm/scripts/index.js +2 -1
- package/dist/esm/scripts/index.js.map +1 -1
- package/dist/esm/scripts/moveStalledJobsToWait-9.js +17 -3
- package/dist/esm/scripts/moveStalledJobsToWait-9.js.map +1 -1
- package/dist/esm/scripts/moveToFinished-14.js +14 -3
- package/dist/esm/scripts/moveToFinished-14.js.map +1 -1
- package/dist/esm/scripts/moveToWaitingChildren-8.js +546 -0
- package/dist/esm/scripts/moveToWaitingChildren-8.js.map +1 -0
- package/dist/esm/scripts/obliterate-2.js +2 -2
- package/dist/esm/scripts/removeChildDependency-1.js +2 -2
- package/dist/esm/scripts/removeJob-3.js +10 -2
- package/dist/esm/scripts/removeJob-3.js.map +1 -1
- package/dist/esm/scripts/removeJobScheduler-3.js +2 -2
- package/dist/esm/scripts/removeRepeatable-3.js +2 -2
- 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
- package/dist/cjs/commands/moveToWaitingChildren-5.lua +0 -68
- package/dist/cjs/scripts/moveToWaitingChildren-5.js +0 -83
- package/dist/cjs/scripts/moveToWaitingChildren-5.js.map +0 -1
- package/dist/esm/commands/moveToWaitingChildren-5.lua +0 -68
- package/dist/esm/scripts/moveToWaitingChildren-5.js +0 -80
- package/dist/esm/scripts/moveToWaitingChildren-5.js.map +0 -1
- /package/dist/esm/scripts/{moveToWaitingChildren-5.d.ts → moveToWaitingChildren-8.d.ts} +0 -0
@@ -0,0 +1,133 @@
|
|
1
|
+
--[[
|
2
|
+
Moves job from active to waiting children set.
|
3
|
+
|
4
|
+
Input:
|
5
|
+
KEYS[1] active key
|
6
|
+
KEYS[2] wait-children key
|
7
|
+
KEYS[3] job key
|
8
|
+
KEYS[4] job dependencies key
|
9
|
+
KEYS[5] job unsuccessful key
|
10
|
+
KEYS[6] stalled key
|
11
|
+
KEYS[7] failed key
|
12
|
+
KEYS[8] events key
|
13
|
+
|
14
|
+
ARGV[1] token
|
15
|
+
ARGV[2] child key
|
16
|
+
ARGV[3] timestamp
|
17
|
+
ARGV[4] jobId
|
18
|
+
ARGV[5] prefix
|
19
|
+
|
20
|
+
Output:
|
21
|
+
0 - OK
|
22
|
+
1 - There are not pending dependencies.
|
23
|
+
-1 - Missing job.
|
24
|
+
-2 - Missing lock
|
25
|
+
-3 - Job not in active set
|
26
|
+
]]
|
27
|
+
local rcall = redis.call
|
28
|
+
local activeKey = KEYS[1]
|
29
|
+
local waitingChildrenKey = KEYS[2]
|
30
|
+
local jobKey = KEYS[3]
|
31
|
+
local jobDependenciesKey = KEYS[4]
|
32
|
+
local jobUnsuccessfulKey = KEYS[5]
|
33
|
+
local stalledKey = KEYS[6]
|
34
|
+
local failedKey = KEYS[7]
|
35
|
+
local timestamp = ARGV[3]
|
36
|
+
local jobId = ARGV[4]
|
37
|
+
|
38
|
+
--- Includes
|
39
|
+
--- @include "includes/moveParentFromWaitingChildrenToFailed"
|
40
|
+
--- @include "includes/moveParentToWaitIfNeeded"
|
41
|
+
--- @include "includes/removeDeduplicationKeyIfNeeded"
|
42
|
+
--- @include "includes/removeJobsOnFail"
|
43
|
+
--- @include "includes/removeLock"
|
44
|
+
|
45
|
+
local function moveToWaitingChildren (activeKey, waitingChildrenKey, jobId,
|
46
|
+
timestamp)
|
47
|
+
local score = tonumber(timestamp)
|
48
|
+
|
49
|
+
local numRemovedElements = rcall("LREM", activeKey, -1, jobId)
|
50
|
+
|
51
|
+
if(numRemovedElements < 1) then
|
52
|
+
return -3
|
53
|
+
end
|
54
|
+
|
55
|
+
rcall("ZADD", waitingChildrenKey, score, jobId)
|
56
|
+
|
57
|
+
return 0
|
58
|
+
end
|
59
|
+
|
60
|
+
if rcall("EXISTS", jobKey) == 1 then
|
61
|
+
if rcall("ZCARD", jobUnsuccessfulKey) ~= 0 then
|
62
|
+
-- TODO: refactor this logic in an include later
|
63
|
+
local jobAttributes = rcall("HMGET", jobKey, "parent", "deid", "opts")
|
64
|
+
|
65
|
+
removeDeduplicationKeyIfNeeded(ARGV[5], jobAttributes[2])
|
66
|
+
|
67
|
+
local failedReason = "children are failed"
|
68
|
+
rcall("ZADD", failedKey, timestamp, jobId)
|
69
|
+
rcall("HSET", jobKey, "finishedOn", timestamp)
|
70
|
+
rcall("XADD", KEYS[8], "*", "event", "failed", "jobId", jobId, "failedReason",
|
71
|
+
failedReason, "prev", "active")
|
72
|
+
|
73
|
+
local rawParentData = jobAttributes[1]
|
74
|
+
local rawOpts = jobAttributes[3]
|
75
|
+
local opts = cjson.decode(rawOpts)
|
76
|
+
|
77
|
+
if rawParentData ~= false then
|
78
|
+
if opts['fpof'] then
|
79
|
+
local parentData = cjson.decode(rawParentData)
|
80
|
+
local parentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
81
|
+
local parentUnsuccesssful = parentKey .. ":unsuccessful"
|
82
|
+
rcall("ZADD", parentUnsuccesssful, timestamp, jobKey)
|
83
|
+
moveParentFromWaitingChildrenToFailed(
|
84
|
+
parentData['queueKey'],
|
85
|
+
parentData['queueKey'] .. ':' .. parentData['id'],
|
86
|
+
parentData['id'],
|
87
|
+
jobKey,
|
88
|
+
timestamp
|
89
|
+
)
|
90
|
+
elseif opts['idof'] or opts['rdof'] then
|
91
|
+
local parentData = cjson.decode(rawParentData)
|
92
|
+
local parentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
93
|
+
local dependenciesSet = parentKey .. ":dependencies"
|
94
|
+
if rcall("SREM", dependenciesSet, jobKey) == 1 then
|
95
|
+
moveParentToWaitIfNeeded(parentData['queueKey'], dependenciesSet,
|
96
|
+
parentKey, parentData['id'], timestamp)
|
97
|
+
if opts['idof'] then
|
98
|
+
local failedSet = parentKey .. ":failed"
|
99
|
+
rcall("HSET", failedSet, jobKey, failedReason)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
removeJobsOnFail(ARGV[5], failedKey, jobId, opts, timestamp)
|
106
|
+
|
107
|
+
return 0
|
108
|
+
else
|
109
|
+
if ARGV[2] ~= "" then
|
110
|
+
if rcall("SISMEMBER", jobDependenciesKey, ARGV[2]) ~= 0 then
|
111
|
+
local errorCode = removeLock(jobKey, stalledKey, ARGV[1], jobId)
|
112
|
+
if errorCode < 0 then
|
113
|
+
return errorCode
|
114
|
+
end
|
115
|
+
return moveToWaitingChildren(activeKey, waitingChildrenKey, jobId, timestamp)
|
116
|
+
end
|
117
|
+
|
118
|
+
return 1
|
119
|
+
else
|
120
|
+
if rcall("SCARD", jobDependenciesKey) ~= 0 then
|
121
|
+
local errorCode = removeLock(jobKey, stalledKey, ARGV[1], jobId)
|
122
|
+
if errorCode < 0 then
|
123
|
+
return errorCode
|
124
|
+
end
|
125
|
+
return moveToWaitingChildren(activeKey, waitingChildrenKey, jobId, timestamp)
|
126
|
+
end
|
127
|
+
|
128
|
+
return 1
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
return -1
|
@@ -65,6 +65,16 @@ local function removeJob(prefix, jobId, parentKey, removeChildren)
|
|
65
65
|
removeJob(childJobPrefix, childJobId, jobKey, removeChildren)
|
66
66
|
end
|
67
67
|
end
|
68
|
+
|
69
|
+
local unsuccessful = rcall("ZRANGE", jobKey .. ":unsuccessful", 0, -1)
|
70
|
+
|
71
|
+
if (#unsuccessful > 0) then
|
72
|
+
for i = 1, #unsuccessful, 1 do
|
73
|
+
local childJobId = getJobIdFromKey(unsuccessful[i])
|
74
|
+
local childJobPrefix = getJobKeyPrefix(unsuccessful[i], childJobId)
|
75
|
+
removeJob(childJobPrefix, childJobId, jobKey, removeChildren)
|
76
|
+
end
|
77
|
+
end
|
68
78
|
end
|
69
79
|
|
70
80
|
local prev = removeJobFromAnyState(prefix, jobId)
|
@@ -227,8 +227,8 @@ end
|
|
227
227
|
Function to remove job keys.
|
228
228
|
]]
|
229
229
|
local function removeJobKeys(jobKey)
|
230
|
-
return rcall("DEL", jobKey, jobKey .. ':logs',
|
231
|
-
jobKey .. ':
|
230
|
+
return rcall("DEL", jobKey, jobKey .. ':logs', jobKey .. ':dependencies',
|
231
|
+
jobKey .. ':processed', jobKey .. ':failed', jobKey .. ':unsuccessful')
|
232
232
|
end
|
233
233
|
--[[
|
234
234
|
Check if this job has a parent. If so we will just remove it from
|
@@ -390,7 +390,7 @@ local function storeJobScheduler(schedulerId, schedulerKey, repeatKey, nextMilli
|
|
390
390
|
table.insert(optionalValues, "data")
|
391
391
|
table.insert(optionalValues, templateData)
|
392
392
|
end
|
393
|
-
rcall("HMSET", schedulerKey, "name", opts['name'], unpack(optionalValues))
|
393
|
+
rcall("HMSET", schedulerKey, "name", opts['name'], "ic", 1, unpack(optionalValues))
|
394
394
|
end
|
395
395
|
-- If we are overriding a repeatable job we must delete the delayed job for
|
396
396
|
-- the next iteration.
|
@@ -42,8 +42,8 @@ end
|
|
42
42
|
Function to remove job keys.
|
43
43
|
]]
|
44
44
|
local function removeJobKeys(jobKey)
|
45
|
-
return rcall("DEL", jobKey, jobKey .. ':logs',
|
46
|
-
jobKey .. ':
|
45
|
+
return rcall("DEL", jobKey, jobKey .. ':logs', jobKey .. ':dependencies',
|
46
|
+
jobKey .. ':processed', jobKey .. ':failed', jobKey .. ':unsuccessful')
|
47
47
|
end
|
48
48
|
--[[
|
49
49
|
Check if this job has a parent. If so we will just remove it from
|
@@ -78,8 +78,8 @@ end
|
|
78
78
|
Function to remove job keys.
|
79
79
|
]]
|
80
80
|
local function removeJobKeys(jobKey)
|
81
|
-
return rcall("DEL", jobKey, jobKey .. ':logs',
|
82
|
-
jobKey .. ':
|
81
|
+
return rcall("DEL", jobKey, jobKey .. ':logs', jobKey .. ':dependencies',
|
82
|
+
jobKey .. ':processed', jobKey .. ':failed', jobKey .. ':unsuccessful')
|
83
83
|
end
|
84
84
|
--[[
|
85
85
|
Check if this job has a parent. If so we will just remove it from
|
@@ -50,8 +50,8 @@ end
|
|
50
50
|
Function to remove job keys.
|
51
51
|
]]
|
52
52
|
local function removeJobKeys(jobKey)
|
53
|
-
return rcall("DEL", jobKey, jobKey .. ':logs',
|
54
|
-
jobKey .. ':
|
53
|
+
return rcall("DEL", jobKey, jobKey .. ':logs', jobKey .. ':dependencies',
|
54
|
+
jobKey .. ':processed', jobKey .. ':failed', jobKey .. ':unsuccessful')
|
55
55
|
end
|
56
56
|
--[[
|
57
57
|
Check if this job has a parent. If so we will just remove it from
|
@@ -0,0 +1,34 @@
|
|
1
|
+
const content = `--[[
|
2
|
+
Get counts per child states
|
3
|
+
Input:
|
4
|
+
KEYS[1] processed key
|
5
|
+
KEYS[2] unprocessed key
|
6
|
+
KEYS[3] ignored key
|
7
|
+
KEYS[4] failed key
|
8
|
+
ARGV[1...] types
|
9
|
+
]]
|
10
|
+
local rcall = redis.call;
|
11
|
+
local processedKey = KEYS[1]
|
12
|
+
local unprocessedKey = KEYS[2]
|
13
|
+
local ignoredKey = KEYS[3]
|
14
|
+
local failedKey = KEYS[4]
|
15
|
+
local results = {}
|
16
|
+
for i = 1, #ARGV do
|
17
|
+
if ARGV[i] == "processed" then
|
18
|
+
results[#results+1] = rcall("HLEN", processedKey)
|
19
|
+
elseif ARGV[i] == "unprocessed" then
|
20
|
+
results[#results+1] = rcall("SCARD", unprocessedKey)
|
21
|
+
elseif ARGV[i] == "ignored" then
|
22
|
+
results[#results+1] = rcall("HLEN", ignoredKey)
|
23
|
+
else
|
24
|
+
results[#results+1] = rcall("ZCARD", failedKey)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
return results
|
28
|
+
`;
|
29
|
+
export const getDependencyCounts = {
|
30
|
+
name: 'getDependencyCounts',
|
31
|
+
content,
|
32
|
+
keys: 4,
|
33
|
+
};
|
34
|
+
//# sourceMappingURL=getDependencyCounts-4.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getDependencyCounts-4.js","sourceRoot":"","sources":["../../../src/scripts/getDependencyCounts-4.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Bf,CAAC;AACF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,qBAAqB;IAC3B,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -13,6 +13,7 @@ export * from './extendLock-2';
|
|
13
13
|
export * from './extendLocks-1';
|
14
14
|
export * from './getCounts-1';
|
15
15
|
export * from './getCountsPerPriority-4';
|
16
|
+
export * from './getDependencyCounts-4';
|
16
17
|
export * from './getJobScheduler-1';
|
17
18
|
export * from './getRanges-1';
|
18
19
|
export * from './getRateLimitTtl-1';
|
@@ -27,7 +28,7 @@ export * from './moveStalledJobsToWait-9';
|
|
27
28
|
export * from './moveToActive-11';
|
28
29
|
export * from './moveToDelayed-8';
|
29
30
|
export * from './moveToFinished-14';
|
30
|
-
export * from './moveToWaitingChildren-
|
31
|
+
export * from './moveToWaitingChildren-8';
|
31
32
|
export * from './obliterate-2';
|
32
33
|
export * from './paginate-1';
|
33
34
|
export * from './pause-7';
|
@@ -13,6 +13,7 @@ export * from './extendLock-2';
|
|
13
13
|
export * from './extendLocks-1';
|
14
14
|
export * from './getCounts-1';
|
15
15
|
export * from './getCountsPerPriority-4';
|
16
|
+
export * from './getDependencyCounts-4';
|
16
17
|
export * from './getJobScheduler-1';
|
17
18
|
export * from './getRanges-1';
|
18
19
|
export * from './getRateLimitTtl-1';
|
@@ -27,7 +28,7 @@ export * from './moveStalledJobsToWait-9';
|
|
27
28
|
export * from './moveToActive-11';
|
28
29
|
export * from './moveToDelayed-8';
|
29
30
|
export * from './moveToFinished-14';
|
30
|
-
export * from './moveToWaitingChildren-
|
31
|
+
export * from './moveToWaitingChildren-8';
|
31
32
|
export * from './obliterate-2';
|
32
33
|
export * from './paginate-1';
|
33
34
|
export * from './pause-7';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/scripts/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc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local function removeJobKeys(jobKey)
|
213
|
-
return rcall("DEL", jobKey, jobKey .. ':logs',
|
214
|
-
jobKey .. ':
|
213
|
+
return rcall("DEL", jobKey, jobKey .. ':logs', jobKey .. ':dependencies',
|
214
|
+
jobKey .. ':processed', jobKey .. ':failed', jobKey .. ':unsuccessful')
|
215
215
|
end
|
216
216
|
--[[
|
217
217
|
Check if this job has a parent. If so we will just remove it from
|
@@ -367,13 +367,16 @@ local function moveParentFromWaitingChildrenToFailed(parentQueueKey, parentKey,
|
|
367
367
|
local parentFailedKey = parentQueueKey .. ":failed"
|
368
368
|
rcall("ZADD", parentFailedKey, timestamp, parentId)
|
369
369
|
local failedReason = "child " .. jobIdKey .. " failed"
|
370
|
-
rcall("
|
370
|
+
rcall("HSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
|
371
371
|
rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
|
372
372
|
failedReason, "prev", "waiting-children")
|
373
373
|
local jobAttributes = rcall("HMGET", parentKey, "parent", "deid", "opts")
|
374
374
|
removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2])
|
375
375
|
if jobAttributes[1] then
|
376
376
|
local parentData = cjson.decode(jobAttributes[1])
|
377
|
+
local grandParentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
378
|
+
local grandParentUnsuccesssful = grandParentKey .. ":unsuccessful"
|
379
|
+
rcall("ZADD", grandParentUnsuccesssful, timestamp, parentKey)
|
377
380
|
if parentData['fpof'] then
|
378
381
|
moveParentFromWaitingChildrenToFailed(
|
379
382
|
parentData['queueKey'],
|
@@ -435,6 +438,12 @@ local function moveParentFromWaitingChildrenToFailed(parentQueueKey, parentKey,
|
|
435
438
|
local parentRawOpts = jobAttributes[3]
|
436
439
|
local parentOpts = cjson.decode(parentRawOpts)
|
437
440
|
removeJobsOnFail(parentQueuePrefix, parentFailedKey, parentId, parentOpts, timestamp)
|
441
|
+
else
|
442
|
+
local grandParentKey = rcall("HGET", parentKey, "parentKey")
|
443
|
+
if grandParentKey then
|
444
|
+
local grandParentUnsuccesssfulSet = grandParentKey .. ":unsuccessful"
|
445
|
+
rcall("ZADD", grandParentUnsuccesssfulSet, timestamp, parentKey)
|
446
|
+
end
|
438
447
|
end
|
439
448
|
end
|
440
449
|
--[[
|
@@ -516,6 +525,11 @@ if (#stalling > 0) then
|
|
516
525
|
if rawParentData then
|
517
526
|
if opts['fpof'] then
|
518
527
|
local parentData = cjson.decode(rawParentData)
|
528
|
+
-- TODO: need to remove this job from dependencies set in next breaking change
|
529
|
+
-- no for now as it would imply a breaking change
|
530
|
+
local parentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
531
|
+
local unsuccesssfulSet = parentKey .. ":unsuccessful"
|
532
|
+
rcall("ZADD", unsuccesssfulSet, timestamp, jobKey)
|
519
533
|
moveParentFromWaitingChildrenToFailed(
|
520
534
|
parentData['queueKey'],
|
521
535
|
parentData['queueKey'] .. ':' .. parentData['id'],
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"moveStalledJobsToWait-9.js","sourceRoot":"","sources":["../../../src/scripts/moveStalledJobsToWait-9.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"moveStalledJobsToWait-9.js","sourceRoot":"","sources":["../../../src/scripts/moveStalledJobsToWait-9.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAmkBS,CAAC;AAC1B,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,uBAAuB;IAC7B,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -305,8 +305,8 @@ end
|
|
305
305
|
Function to remove job keys.
|
306
306
|
]]
|
307
307
|
local function removeJobKeys(jobKey)
|
308
|
-
return rcall("DEL", jobKey, jobKey .. ':logs',
|
309
|
-
jobKey .. ':
|
308
|
+
return rcall("DEL", jobKey, jobKey .. ':logs', jobKey .. ':dependencies',
|
309
|
+
jobKey .. ':processed', jobKey .. ':failed', jobKey .. ':unsuccessful')
|
310
310
|
end
|
311
311
|
--[[
|
312
312
|
Check if this job has a parent. If so we will just remove it from
|
@@ -462,13 +462,16 @@ local function moveParentFromWaitingChildrenToFailed(parentQueueKey, parentKey,
|
|
462
462
|
local parentFailedKey = parentQueueKey .. ":failed"
|
463
463
|
rcall("ZADD", parentFailedKey, timestamp, parentId)
|
464
464
|
local failedReason = "child " .. jobIdKey .. " failed"
|
465
|
-
rcall("
|
465
|
+
rcall("HSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
|
466
466
|
rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
|
467
467
|
failedReason, "prev", "waiting-children")
|
468
468
|
local jobAttributes = rcall("HMGET", parentKey, "parent", "deid", "opts")
|
469
469
|
removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2])
|
470
470
|
if jobAttributes[1] then
|
471
471
|
local parentData = cjson.decode(jobAttributes[1])
|
472
|
+
local grandParentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
473
|
+
local grandParentUnsuccesssful = grandParentKey .. ":unsuccessful"
|
474
|
+
rcall("ZADD", grandParentUnsuccesssful, timestamp, parentKey)
|
472
475
|
if parentData['fpof'] then
|
473
476
|
moveParentFromWaitingChildrenToFailed(
|
474
477
|
parentData['queueKey'],
|
@@ -530,6 +533,12 @@ local function moveParentFromWaitingChildrenToFailed(parentQueueKey, parentKey,
|
|
530
533
|
local parentRawOpts = jobAttributes[3]
|
531
534
|
local parentOpts = cjson.decode(parentRawOpts)
|
532
535
|
removeJobsOnFail(parentQueuePrefix, parentFailedKey, parentId, parentOpts, timestamp)
|
536
|
+
else
|
537
|
+
local grandParentKey = rcall("HGET", parentKey, "parentKey")
|
538
|
+
if grandParentKey then
|
539
|
+
local grandParentUnsuccesssfulSet = grandParentKey .. ":unsuccessful"
|
540
|
+
rcall("ZADD", grandParentUnsuccesssfulSet, timestamp, parentKey)
|
541
|
+
end
|
533
542
|
end
|
534
543
|
end
|
535
544
|
--[[
|
@@ -719,6 +728,8 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
|
|
719
728
|
end
|
720
729
|
else
|
721
730
|
if opts['fpof'] then
|
731
|
+
local unsuccesssfulSet = parentKey .. ":unsuccessful"
|
732
|
+
rcall("ZADD", unsuccesssfulSet, timestamp, jobIdKey)
|
722
733
|
moveParentFromWaitingChildrenToFailed(parentQueueKey, parentKey,
|
723
734
|
parentId, jobIdKey,
|
724
735
|
timestamp)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"moveToFinished-14.js","sourceRoot":"","sources":["../../../src/scripts/moveToFinished-14.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"moveToFinished-14.js","sourceRoot":"","sources":["../../../src/sc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