bullmq 5.44.0 → 5.44.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/dist/cjs/commands/includes/moveParentToFailedIfNeeded.lua +82 -0
- package/dist/cjs/commands/includes/moveParentToWaitIfNeeded.lua +1 -1
- package/dist/cjs/commands/moveStalledJobsToWait-9.lua +2 -2
- package/dist/cjs/commands/moveToFinished-14.lua +2 -2
- package/dist/cjs/commands/moveToWaitingChildren-8.lua +3 -3
- package/dist/cjs/scripts/addDelayedJob-6.js +1 -1
- package/dist/cjs/scripts/addParentJob-4.js +1 -1
- package/dist/cjs/scripts/addPrioritizedJob-8.js +1 -1
- package/dist/cjs/scripts/addStandardJob-8.js +1 -1
- package/dist/cjs/scripts/moveStalledJobsToWait-9.js +60 -82
- package/dist/cjs/scripts/moveStalledJobsToWait-9.js.map +1 -1
- package/dist/cjs/scripts/moveToFinished-14.js +60 -82
- package/dist/cjs/scripts/moveToFinished-14.js.map +1 -1
- package/dist/cjs/scripts/moveToWaitingChildren-8.js +61 -83
- package/dist/cjs/scripts/moveToWaitingChildren-8.js.map +1 -1
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/commands/includes/moveParentToFailedIfNeeded.lua +82 -0
- package/dist/esm/commands/includes/moveParentToWaitIfNeeded.lua +1 -1
- package/dist/esm/commands/moveStalledJobsToWait-9.lua +2 -2
- package/dist/esm/commands/moveToFinished-14.lua +2 -2
- package/dist/esm/commands/moveToWaitingChildren-8.lua +3 -3
- package/dist/esm/scripts/addDelayedJob-6.js +1 -1
- package/dist/esm/scripts/addParentJob-4.js +1 -1
- package/dist/esm/scripts/addPrioritizedJob-8.js +1 -1
- package/dist/esm/scripts/addStandardJob-8.js +1 -1
- package/dist/esm/scripts/moveStalledJobsToWait-9.js +60 -82
- package/dist/esm/scripts/moveStalledJobsToWait-9.js.map +1 -1
- package/dist/esm/scripts/moveToFinished-14.js +60 -82
- package/dist/esm/scripts/moveToFinished-14.js.map +1 -1
- package/dist/esm/scripts/moveToWaitingChildren-8.js +61 -83
- package/dist/esm/scripts/moveToWaitingChildren-8.js.map +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
- package/dist/cjs/commands/includes/moveParentFromWaitingChildrenToFailed.lua +0 -108
- package/dist/esm/commands/includes/moveParentFromWaitingChildrenToFailed.lua +0 -108
@@ -1,108 +0,0 @@
|
|
1
|
-
--[[
|
2
|
-
Function to recursively move from waitingChildren to failed.
|
3
|
-
]]
|
4
|
-
|
5
|
-
-- Includes
|
6
|
-
--- @include "moveParentToWaitIfNeeded"
|
7
|
-
--- @include "removeDeduplicationKeyIfNeeded"
|
8
|
-
--- @include "removeJobsOnFail"
|
9
|
-
|
10
|
-
local function moveParentFromWaitingChildrenToFailed(parentQueueKey, parentKey, parentId, jobIdKey, timestamp)
|
11
|
-
local parentWaitingChildrenKey = parentQueueKey .. ":waiting-children"
|
12
|
-
local parentDelayedKey = parentQueueKey .. ":delayed"
|
13
|
-
if rcall("ZSCORE", parentWaitingChildrenKey, parentId) ~= false then
|
14
|
-
rcall("ZREM", parentWaitingChildrenKey, parentId)
|
15
|
-
local parentQueuePrefix = parentQueueKey .. ":"
|
16
|
-
local parentFailedKey = parentQueueKey .. ":failed"
|
17
|
-
rcall("ZADD", parentFailedKey, timestamp, parentId)
|
18
|
-
local failedReason = "child " .. jobIdKey .. " failed"
|
19
|
-
rcall("HSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
|
20
|
-
rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
|
21
|
-
failedReason, "prev", "waiting-children")
|
22
|
-
|
23
|
-
local jobAttributes = rcall("HMGET", parentKey, "parent", "deid", "opts")
|
24
|
-
|
25
|
-
removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2])
|
26
|
-
|
27
|
-
if jobAttributes[1] then
|
28
|
-
local parentData = cjson.decode(jobAttributes[1])
|
29
|
-
local grandParentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
30
|
-
local grandParentUnsuccesssful = grandParentKey .. ":unsuccessful"
|
31
|
-
rcall("ZADD", grandParentUnsuccesssful, timestamp, parentKey)
|
32
|
-
if parentData['fpof'] then
|
33
|
-
moveParentFromWaitingChildrenToFailed(
|
34
|
-
parentData['queueKey'],
|
35
|
-
parentData['queueKey'] .. ':' .. parentData['id'],
|
36
|
-
parentData['id'],
|
37
|
-
parentKey,
|
38
|
-
timestamp
|
39
|
-
)
|
40
|
-
elseif parentData['idof'] or parentData['rdof'] then
|
41
|
-
local grandParentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
42
|
-
local grandParentDependenciesSet = grandParentKey .. ":dependencies"
|
43
|
-
if rcall("SREM", grandParentDependenciesSet, parentKey) == 1 then
|
44
|
-
moveParentToWaitIfNeeded(parentData['queueKey'], grandParentDependenciesSet,
|
45
|
-
grandParentKey, parentData['id'], timestamp)
|
46
|
-
if parentData['idof'] then
|
47
|
-
local grandParentFailedSet = grandParentKey .. ":failed"
|
48
|
-
rcall("HSET", grandParentFailedSet, parentKey, failedReason)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
local parentRawOpts = jobAttributes[3]
|
55
|
-
local parentOpts = cjson.decode(parentRawOpts)
|
56
|
-
|
57
|
-
removeJobsOnFail(parentQueuePrefix, parentFailedKey, parentId, parentOpts, timestamp)
|
58
|
-
elseif rcall("ZSCORE", parentDelayedKey, parentId) ~= false then
|
59
|
-
rcall("ZREM", parentDelayedKey, parentId)
|
60
|
-
local parentQueuePrefix = parentQueueKey .. ":"
|
61
|
-
local parentFailedKey = parentQueueKey .. ":failed"
|
62
|
-
rcall("ZADD", parentFailedKey, timestamp, parentId)
|
63
|
-
local failedReason = "child " .. jobIdKey .. " failed"
|
64
|
-
rcall("HMSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
|
65
|
-
rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
|
66
|
-
failedReason, "prev", "delayed")
|
67
|
-
|
68
|
-
local jobAttributes = rcall("HMGET", parentKey, "parent", "deid", "opts")
|
69
|
-
|
70
|
-
removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2])
|
71
|
-
|
72
|
-
if jobAttributes[1] then
|
73
|
-
local parentData = cjson.decode(jobAttributes[1])
|
74
|
-
if parentData['fpof'] then
|
75
|
-
moveParentFromWaitingChildrenToFailed(
|
76
|
-
parentData['queueKey'],
|
77
|
-
parentData['queueKey'] .. ':' .. parentData['id'],
|
78
|
-
parentData['id'],
|
79
|
-
parentKey,
|
80
|
-
timestamp
|
81
|
-
)
|
82
|
-
elseif parentData['idof'] or parentData['rdof'] then
|
83
|
-
local grandParentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
84
|
-
local grandParentDependenciesSet = grandParentKey .. ":dependencies"
|
85
|
-
if rcall("SREM", grandParentDependenciesSet, parentKey) == 1 then
|
86
|
-
moveParentToWaitIfNeeded(parentData['queueKey'], grandParentDependenciesSet,
|
87
|
-
grandParentKey, parentData['id'], timestamp)
|
88
|
-
if parentData['idof'] then
|
89
|
-
local grandParentFailedSet = grandParentKey .. ":failed"
|
90
|
-
rcall("HSET", grandParentFailedSet, parentKey, failedReason)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
local parentRawOpts = jobAttributes[3]
|
97
|
-
local parentOpts = cjson.decode(parentRawOpts)
|
98
|
-
|
99
|
-
removeJobsOnFail(parentQueuePrefix, parentFailedKey, parentId, parentOpts, timestamp)
|
100
|
-
else
|
101
|
-
local grandParentKey = rcall("HGET", parentKey, "parentKey")
|
102
|
-
|
103
|
-
if grandParentKey then
|
104
|
-
local grandParentUnsuccesssfulSet = grandParentKey .. ":unsuccessful"
|
105
|
-
rcall("ZADD", grandParentUnsuccesssfulSet, timestamp, parentKey)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
@@ -1,108 +0,0 @@
|
|
1
|
-
--[[
|
2
|
-
Function to recursively move from waitingChildren to failed.
|
3
|
-
]]
|
4
|
-
|
5
|
-
-- Includes
|
6
|
-
--- @include "moveParentToWaitIfNeeded"
|
7
|
-
--- @include "removeDeduplicationKeyIfNeeded"
|
8
|
-
--- @include "removeJobsOnFail"
|
9
|
-
|
10
|
-
local function moveParentFromWaitingChildrenToFailed(parentQueueKey, parentKey, parentId, jobIdKey, timestamp)
|
11
|
-
local parentWaitingChildrenKey = parentQueueKey .. ":waiting-children"
|
12
|
-
local parentDelayedKey = parentQueueKey .. ":delayed"
|
13
|
-
if rcall("ZSCORE", parentWaitingChildrenKey, parentId) ~= false then
|
14
|
-
rcall("ZREM", parentWaitingChildrenKey, parentId)
|
15
|
-
local parentQueuePrefix = parentQueueKey .. ":"
|
16
|
-
local parentFailedKey = parentQueueKey .. ":failed"
|
17
|
-
rcall("ZADD", parentFailedKey, timestamp, parentId)
|
18
|
-
local failedReason = "child " .. jobIdKey .. " failed"
|
19
|
-
rcall("HSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
|
20
|
-
rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
|
21
|
-
failedReason, "prev", "waiting-children")
|
22
|
-
|
23
|
-
local jobAttributes = rcall("HMGET", parentKey, "parent", "deid", "opts")
|
24
|
-
|
25
|
-
removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2])
|
26
|
-
|
27
|
-
if jobAttributes[1] then
|
28
|
-
local parentData = cjson.decode(jobAttributes[1])
|
29
|
-
local grandParentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
30
|
-
local grandParentUnsuccesssful = grandParentKey .. ":unsuccessful"
|
31
|
-
rcall("ZADD", grandParentUnsuccesssful, timestamp, parentKey)
|
32
|
-
if parentData['fpof'] then
|
33
|
-
moveParentFromWaitingChildrenToFailed(
|
34
|
-
parentData['queueKey'],
|
35
|
-
parentData['queueKey'] .. ':' .. parentData['id'],
|
36
|
-
parentData['id'],
|
37
|
-
parentKey,
|
38
|
-
timestamp
|
39
|
-
)
|
40
|
-
elseif parentData['idof'] or parentData['rdof'] then
|
41
|
-
local grandParentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
42
|
-
local grandParentDependenciesSet = grandParentKey .. ":dependencies"
|
43
|
-
if rcall("SREM", grandParentDependenciesSet, parentKey) == 1 then
|
44
|
-
moveParentToWaitIfNeeded(parentData['queueKey'], grandParentDependenciesSet,
|
45
|
-
grandParentKey, parentData['id'], timestamp)
|
46
|
-
if parentData['idof'] then
|
47
|
-
local grandParentFailedSet = grandParentKey .. ":failed"
|
48
|
-
rcall("HSET", grandParentFailedSet, parentKey, failedReason)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
local parentRawOpts = jobAttributes[3]
|
55
|
-
local parentOpts = cjson.decode(parentRawOpts)
|
56
|
-
|
57
|
-
removeJobsOnFail(parentQueuePrefix, parentFailedKey, parentId, parentOpts, timestamp)
|
58
|
-
elseif rcall("ZSCORE", parentDelayedKey, parentId) ~= false then
|
59
|
-
rcall("ZREM", parentDelayedKey, parentId)
|
60
|
-
local parentQueuePrefix = parentQueueKey .. ":"
|
61
|
-
local parentFailedKey = parentQueueKey .. ":failed"
|
62
|
-
rcall("ZADD", parentFailedKey, timestamp, parentId)
|
63
|
-
local failedReason = "child " .. jobIdKey .. " failed"
|
64
|
-
rcall("HMSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
|
65
|
-
rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
|
66
|
-
failedReason, "prev", "delayed")
|
67
|
-
|
68
|
-
local jobAttributes = rcall("HMGET", parentKey, "parent", "deid", "opts")
|
69
|
-
|
70
|
-
removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2])
|
71
|
-
|
72
|
-
if jobAttributes[1] then
|
73
|
-
local parentData = cjson.decode(jobAttributes[1])
|
74
|
-
if parentData['fpof'] then
|
75
|
-
moveParentFromWaitingChildrenToFailed(
|
76
|
-
parentData['queueKey'],
|
77
|
-
parentData['queueKey'] .. ':' .. parentData['id'],
|
78
|
-
parentData['id'],
|
79
|
-
parentKey,
|
80
|
-
timestamp
|
81
|
-
)
|
82
|
-
elseif parentData['idof'] or parentData['rdof'] then
|
83
|
-
local grandParentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
84
|
-
local grandParentDependenciesSet = grandParentKey .. ":dependencies"
|
85
|
-
if rcall("SREM", grandParentDependenciesSet, parentKey) == 1 then
|
86
|
-
moveParentToWaitIfNeeded(parentData['queueKey'], grandParentDependenciesSet,
|
87
|
-
grandParentKey, parentData['id'], timestamp)
|
88
|
-
if parentData['idof'] then
|
89
|
-
local grandParentFailedSet = grandParentKey .. ":failed"
|
90
|
-
rcall("HSET", grandParentFailedSet, parentKey, failedReason)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
local parentRawOpts = jobAttributes[3]
|
97
|
-
local parentOpts = cjson.decode(parentRawOpts)
|
98
|
-
|
99
|
-
removeJobsOnFail(parentQueuePrefix, parentFailedKey, parentId, parentOpts, timestamp)
|
100
|
-
else
|
101
|
-
local grandParentKey = rcall("HGET", parentKey, "parentKey")
|
102
|
-
|
103
|
-
if grandParentKey then
|
104
|
-
local grandParentUnsuccesssfulSet = grandParentKey .. ":unsuccessful"
|
105
|
-
rcall("ZADD", grandParentUnsuccesssfulSet, timestamp, parentKey)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|