bullmq 5.44.1 → 5.44.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/cjs/commands/includes/moveParentToFailedIfNeeded.lua +82 -0
  2. package/dist/cjs/commands/includes/moveParentToWaitIfNeeded.lua +1 -1
  3. package/dist/cjs/commands/moveStalledJobsToWait-9.lua +2 -2
  4. package/dist/cjs/commands/moveToFinished-14.lua +5 -4
  5. package/dist/cjs/commands/moveToWaitingChildren-8.lua +3 -3
  6. package/dist/cjs/scripts/addDelayedJob-6.js +1 -1
  7. package/dist/cjs/scripts/addParentJob-4.js +1 -1
  8. package/dist/cjs/scripts/addPrioritizedJob-8.js +1 -1
  9. package/dist/cjs/scripts/addStandardJob-8.js +1 -1
  10. package/dist/cjs/scripts/moveStalledJobsToWait-9.js +61 -59
  11. package/dist/cjs/scripts/moveStalledJobsToWait-9.js.map +1 -1
  12. package/dist/cjs/scripts/moveToFinished-14.js +64 -61
  13. package/dist/cjs/scripts/moveToFinished-14.js.map +1 -1
  14. package/dist/cjs/scripts/moveToWaitingChildren-8.js +62 -60
  15. package/dist/cjs/scripts/moveToWaitingChildren-8.js.map +1 -1
  16. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  17. package/dist/cjs/version.js +1 -1
  18. package/dist/esm/commands/includes/moveParentToFailedIfNeeded.lua +82 -0
  19. package/dist/esm/commands/includes/moveParentToWaitIfNeeded.lua +1 -1
  20. package/dist/esm/commands/moveStalledJobsToWait-9.lua +2 -2
  21. package/dist/esm/commands/moveToFinished-14.lua +5 -4
  22. package/dist/esm/commands/moveToWaitingChildren-8.lua +3 -3
  23. package/dist/esm/scripts/addDelayedJob-6.js +1 -1
  24. package/dist/esm/scripts/addParentJob-4.js +1 -1
  25. package/dist/esm/scripts/addPrioritizedJob-8.js +1 -1
  26. package/dist/esm/scripts/addStandardJob-8.js +1 -1
  27. package/dist/esm/scripts/moveStalledJobsToWait-9.js +61 -59
  28. package/dist/esm/scripts/moveStalledJobsToWait-9.js.map +1 -1
  29. package/dist/esm/scripts/moveToFinished-14.js +64 -61
  30. package/dist/esm/scripts/moveToFinished-14.js.map +1 -1
  31. package/dist/esm/scripts/moveToWaitingChildren-8.js +62 -60
  32. package/dist/esm/scripts/moveToWaitingChildren-8.js.map +1 -1
  33. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  34. package/dist/esm/version.d.ts +1 -1
  35. package/dist/esm/version.js +1 -1
  36. package/package.json +1 -1
  37. package/dist/cjs/commands/includes/moveParentFromWaitingChildrenToFailed.lua +0 -80
  38. package/dist/esm/commands/includes/moveParentFromWaitingChildrenToFailed.lua +0 -80
@@ -1,80 +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
- local parentPrioritizedKey = parentQueueKey .. ":prioritized"
14
- local parentWaitingChildrenOrDelayedOrPrioritizedKey
15
- local prevState
16
- if rcall("ZSCORE", parentWaitingChildrenKey, parentId) then
17
- parentWaitingChildrenOrDelayedOrPrioritizedKey = parentWaitingChildrenKey
18
- prevState = "waiting-children"
19
- elseif rcall("ZSCORE", parentDelayedKey, parentId) then
20
- parentWaitingChildrenOrDelayedOrPrioritizedKey = parentDelayedKey
21
- prevState = "delayed"
22
- elseif rcall("ZSCORE", parentPrioritizedKey, parentId) then
23
- parentWaitingChildrenOrDelayedOrPrioritizedKey = parentPrioritizedKey
24
- prevState = "prioritized"
25
- end
26
-
27
- if parentWaitingChildrenOrDelayedOrPrioritizedKey then
28
- rcall("ZREM", parentWaitingChildrenOrDelayedOrPrioritizedKey, parentId)
29
- local parentQueuePrefix = parentQueueKey .. ":"
30
- local parentFailedKey = parentQueueKey .. ":failed"
31
- rcall("ZADD", parentFailedKey, timestamp, parentId)
32
- local failedReason = "child " .. jobIdKey .. " failed"
33
- rcall("HSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
34
- rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
35
- failedReason, "prev", prevState)
36
-
37
- local jobAttributes = rcall("HMGET", parentKey, "parent", "deid", "opts")
38
-
39
- removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2])
40
-
41
- if jobAttributes[1] then
42
- local parentData = cjson.decode(jobAttributes[1])
43
- local grandParentKey = parentData['queueKey'] .. ':' .. parentData['id']
44
- local grandParentUnsuccesssful = grandParentKey .. ":unsuccessful"
45
- rcall("ZADD", grandParentUnsuccesssful, timestamp, parentKey)
46
- if parentData['fpof'] then
47
- moveParentFromWaitingChildrenToFailed(
48
- parentData['queueKey'],
49
- parentData['queueKey'] .. ':' .. parentData['id'],
50
- parentData['id'],
51
- parentKey,
52
- timestamp
53
- )
54
- elseif parentData['idof'] or parentData['rdof'] then
55
- local grandParentKey = parentData['queueKey'] .. ':' .. parentData['id']
56
- local grandParentDependenciesSet = grandParentKey .. ":dependencies"
57
- if rcall("SREM", grandParentDependenciesSet, parentKey) == 1 then
58
- moveParentToWaitIfNeeded(parentData['queueKey'], grandParentDependenciesSet,
59
- grandParentKey, parentData['id'], timestamp)
60
- if parentData['idof'] then
61
- local grandParentFailedSet = grandParentKey .. ":failed"
62
- rcall("HSET", grandParentFailedSet, parentKey, failedReason)
63
- end
64
- end
65
- end
66
- end
67
-
68
- local parentRawOpts = jobAttributes[3]
69
- local parentOpts = cjson.decode(parentRawOpts)
70
-
71
- removeJobsOnFail(parentQueuePrefix, parentFailedKey, parentId, parentOpts, timestamp)
72
- else
73
- local grandParentKey = rcall("HGET", parentKey, "parentKey")
74
-
75
- if grandParentKey then
76
- local grandParentUnsuccesssfulSet = grandParentKey .. ":unsuccessful"
77
- rcall("ZADD", grandParentUnsuccesssfulSet, timestamp, parentKey)
78
- end
79
- end
80
- end