bullmq 5.49.1 → 5.50.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.
Files changed (110) hide show
  1. package/dist/cjs/classes/job.js +23 -18
  2. package/dist/cjs/classes/job.js.map +1 -1
  3. package/dist/cjs/classes/queue.js +0 -1
  4. package/dist/cjs/classes/queue.js.map +1 -1
  5. package/dist/cjs/classes/worker.js +4 -0
  6. package/dist/cjs/classes/worker.js.map +1 -1
  7. package/dist/cjs/commands/includes/moveChildFromDependenciesIfNeeded.lua +15 -32
  8. package/dist/cjs/commands/includes/moveParentToWait.lua +32 -33
  9. package/dist/cjs/commands/includes/moveParentToWaitIfNeeded.lua +8 -4
  10. package/dist/cjs/commands/includes/moveParentToWaitIfNoPendingDependencies.lua +13 -0
  11. package/dist/cjs/commands/includes/removeDeduplicationKeyIfNeededOnFinalization.lua +23 -0
  12. package/dist/cjs/commands/includes/removeDeduplicationKeyIfNeededOnRemoval.lua +16 -0
  13. package/dist/cjs/commands/includes/removeJob.lua +2 -2
  14. package/dist/cjs/commands/includes/removeJobWithChildren.lua +2 -2
  15. package/dist/cjs/commands/includes/updateParentDepsIfNeeded.lua +2 -2
  16. package/dist/cjs/commands/moveStalledJobsToWait-9.lua +2 -4
  17. package/dist/cjs/commands/moveToFinished-14.lua +7 -5
  18. package/dist/cjs/commands/moveToWaitingChildren-8.lua +2 -4
  19. package/dist/cjs/scripts/addDelayedJob-6.js +51 -37
  20. package/dist/cjs/scripts/addDelayedJob-6.js.map +1 -1
  21. package/dist/cjs/scripts/addJobScheduler-11.js +9 -4
  22. package/dist/cjs/scripts/addJobScheduler-11.js.map +1 -1
  23. package/dist/cjs/scripts/addParentJob-4.js +51 -37
  24. package/dist/cjs/scripts/addParentJob-4.js.map +1 -1
  25. package/dist/cjs/scripts/addPrioritizedJob-8.js +51 -37
  26. package/dist/cjs/scripts/addPrioritizedJob-8.js.map +1 -1
  27. package/dist/cjs/scripts/addRepeatableJob-2.js +9 -4
  28. package/dist/cjs/scripts/addRepeatableJob-2.js.map +1 -1
  29. package/dist/cjs/scripts/addStandardJob-8.js +51 -37
  30. package/dist/cjs/scripts/addStandardJob-8.js.map +1 -1
  31. package/dist/cjs/scripts/cleanJobsInSet-3.js +9 -4
  32. package/dist/cjs/scripts/cleanJobsInSet-3.js.map +1 -1
  33. package/dist/cjs/scripts/drain-5.js +9 -4
  34. package/dist/cjs/scripts/drain-5.js.map +1 -1
  35. package/dist/cjs/scripts/moveStalledJobsToWait-9.js +92 -76
  36. package/dist/cjs/scripts/moveStalledJobsToWait-9.js.map +1 -1
  37. package/dist/cjs/scripts/moveToFinished-14.js +97 -78
  38. package/dist/cjs/scripts/moveToFinished-14.js.map +1 -1
  39. package/dist/cjs/scripts/moveToWaitingChildren-8.js +92 -76
  40. package/dist/cjs/scripts/moveToWaitingChildren-8.js.map +1 -1
  41. package/dist/cjs/scripts/obliterate-2.js +9 -4
  42. package/dist/cjs/scripts/obliterate-2.js.map +1 -1
  43. package/dist/cjs/scripts/removeJob-3.js +9 -4
  44. package/dist/cjs/scripts/removeJob-3.js.map +1 -1
  45. package/dist/cjs/scripts/removeUnprocessedChildren-2.js +9 -4
  46. package/dist/cjs/scripts/removeUnprocessedChildren-2.js.map +1 -1
  47. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  48. package/dist/cjs/utils.js +11 -1
  49. package/dist/cjs/utils.js.map +1 -1
  50. package/dist/cjs/version.js +1 -1
  51. package/dist/esm/classes/job.d.ts +21 -4
  52. package/dist/esm/classes/job.js +24 -19
  53. package/dist/esm/classes/job.js.map +1 -1
  54. package/dist/esm/classes/queue.d.ts +0 -1
  55. package/dist/esm/classes/queue.js +0 -1
  56. package/dist/esm/classes/queue.js.map +1 -1
  57. package/dist/esm/classes/worker.js +5 -1
  58. package/dist/esm/classes/worker.js.map +1 -1
  59. package/dist/esm/commands/includes/moveChildFromDependenciesIfNeeded.lua +15 -32
  60. package/dist/esm/commands/includes/moveParentToWait.lua +32 -33
  61. package/dist/esm/commands/includes/moveParentToWaitIfNeeded.lua +8 -4
  62. package/dist/esm/commands/includes/moveParentToWaitIfNoPendingDependencies.lua +13 -0
  63. package/dist/esm/commands/includes/removeDeduplicationKeyIfNeededOnFinalization.lua +23 -0
  64. package/dist/esm/commands/includes/removeDeduplicationKeyIfNeededOnRemoval.lua +16 -0
  65. package/dist/esm/commands/includes/removeJob.lua +2 -2
  66. package/dist/esm/commands/includes/removeJobWithChildren.lua +2 -2
  67. package/dist/esm/commands/includes/updateParentDepsIfNeeded.lua +2 -2
  68. package/dist/esm/commands/moveStalledJobsToWait-9.lua +2 -4
  69. package/dist/esm/commands/moveToFinished-14.lua +7 -5
  70. package/dist/esm/commands/moveToWaitingChildren-8.lua +2 -4
  71. package/dist/esm/interfaces/job-json.d.ts +1 -0
  72. package/dist/esm/scripts/addDelayedJob-6.js +51 -37
  73. package/dist/esm/scripts/addDelayedJob-6.js.map +1 -1
  74. package/dist/esm/scripts/addJobScheduler-11.js +9 -4
  75. package/dist/esm/scripts/addJobScheduler-11.js.map +1 -1
  76. package/dist/esm/scripts/addParentJob-4.js +51 -37
  77. package/dist/esm/scripts/addParentJob-4.js.map +1 -1
  78. package/dist/esm/scripts/addPrioritizedJob-8.js +51 -37
  79. package/dist/esm/scripts/addPrioritizedJob-8.js.map +1 -1
  80. package/dist/esm/scripts/addRepeatableJob-2.js +9 -4
  81. package/dist/esm/scripts/addRepeatableJob-2.js.map +1 -1
  82. package/dist/esm/scripts/addStandardJob-8.js +51 -37
  83. package/dist/esm/scripts/addStandardJob-8.js.map +1 -1
  84. package/dist/esm/scripts/cleanJobsInSet-3.js +9 -4
  85. package/dist/esm/scripts/cleanJobsInSet-3.js.map +1 -1
  86. package/dist/esm/scripts/drain-5.js +9 -4
  87. package/dist/esm/scripts/drain-5.js.map +1 -1
  88. package/dist/esm/scripts/moveStalledJobsToWait-9.js +92 -76
  89. package/dist/esm/scripts/moveStalledJobsToWait-9.js.map +1 -1
  90. package/dist/esm/scripts/moveToFinished-14.js +97 -78
  91. package/dist/esm/scripts/moveToFinished-14.js.map +1 -1
  92. package/dist/esm/scripts/moveToWaitingChildren-8.js +92 -76
  93. package/dist/esm/scripts/moveToWaitingChildren-8.js.map +1 -1
  94. package/dist/esm/scripts/obliterate-2.js +9 -4
  95. package/dist/esm/scripts/obliterate-2.js.map +1 -1
  96. package/dist/esm/scripts/removeJob-3.js +9 -4
  97. package/dist/esm/scripts/removeJob-3.js.map +1 -1
  98. package/dist/esm/scripts/removeUnprocessedChildren-2.js +9 -4
  99. package/dist/esm/scripts/removeUnprocessedChildren-2.js.map +1 -1
  100. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  101. package/dist/esm/utils.d.ts +17 -0
  102. package/dist/esm/utils.js +10 -0
  103. package/dist/esm/utils.js.map +1 -1
  104. package/dist/esm/version.d.ts +1 -1
  105. package/dist/esm/version.js +1 -1
  106. package/package.json +1 -1
  107. package/dist/cjs/commands/includes/removeDeduplicationKey.lua +0 -11
  108. package/dist/cjs/commands/includes/removeDeduplicationKeyIfNeeded.lua +0 -14
  109. package/dist/esm/commands/includes/removeDeduplicationKey.lua +0 -11
  110. package/dist/esm/commands/includes/removeDeduplicationKeyIfNeeded.lua +0 -14
@@ -0,0 +1,13 @@
1
+ --[[
2
+ Validate and move parent to a wait status (waiting, delayed or prioritized)
3
+ if no pending dependencies.
4
+ ]]
5
+ -- Includes
6
+ --- @include "moveParentToWaitIfNeeded"
7
+ local function moveParentToWaitIfNoPendingDependencies(parentQueueKey, parentDependenciesKey, parentKey,
8
+ parentId, timestamp)
9
+ local doNotHavePendingDependencies = rcall("SCARD", parentDependenciesKey) == 0
10
+ if doNotHavePendingDependencies then
11
+ moveParentToWaitIfNeeded(parentQueueKey, parentKey, parentId, timestamp)
12
+ end
13
+ end
@@ -0,0 +1,23 @@
1
+ --[[
2
+ Function to remove deduplication key if needed
3
+ when a job is moved to completed or failed states.
4
+ ]]
5
+
6
+ local function removeDeduplicationKeyIfNeededOnFinalization(prefixKey,
7
+ deduplicationId, jobId)
8
+ if deduplicationId then
9
+ local deduplicationKey = prefixKey .. "de:" .. deduplicationId
10
+ local pttl = rcall("PTTL", deduplicationKey)
11
+
12
+ if pttl == 0 then
13
+ return rcall("DEL", deduplicationKey)
14
+ end
15
+
16
+ if pttl == -1 then
17
+ local currentJobId = rcall('GET', deduplicationKey)
18
+ if currentJobId and currentJobId == jobId then
19
+ return rcall("DEL", deduplicationKey)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,16 @@
1
+ --[[
2
+ Function to remove deduplication key if needed
3
+ when a job is being removed.
4
+ ]]
5
+
6
+ local function removeDeduplicationKeyIfNeededOnRemoval(prefixKey,
7
+ jobKey, jobId)
8
+ local deduplicationId = rcall("HGET", jobKey, "deid")
9
+ if deduplicationId then
10
+ local deduplicationKey = prefixKey .. "de:" .. deduplicationId
11
+ local currentJobId = rcall('GET', deduplicationKey)
12
+ if currentJobId and currentJobId == jobId then
13
+ return rcall("DEL", deduplicationKey)
14
+ end
15
+ end
16
+ end
@@ -3,7 +3,7 @@
3
3
  ]]
4
4
 
5
5
  -- Includes
6
- --- @include "removeDeduplicationKey"
6
+ --- @include "removeDeduplicationKeyIfNeededOnRemoval"
7
7
  --- @include "removeJobKeys"
8
8
  --- @include "removeParentDependencyKey"
9
9
 
@@ -11,7 +11,7 @@ local function removeJob(jobId, hard, baseKey, shouldRemoveDeduplicationKey)
11
11
  local jobKey = baseKey .. jobId
12
12
  removeParentDependencyKey(jobKey, hard, nil, baseKey)
13
13
  if shouldRemoveDeduplicationKey then
14
- removeDeduplicationKey(baseKey, jobKey)
14
+ removeDeduplicationKeyIfNeededOnRemoval(baseKey, jobKey, jobId)
15
15
  end
16
16
  removeJobKeys(jobKey)
17
17
  end
@@ -12,7 +12,7 @@ local rcall = redis.call
12
12
  --- @include "destructureJobKey"
13
13
  --- @include "getOrSetMaxEvents"
14
14
  --- @include "isJobSchedulerJob"
15
- --- @include "removeDeduplicationKey"
15
+ --- @include "removeDeduplicationKeyIfNeededOnRemoval"
16
16
  --- @include "removeJobFromAnyState"
17
17
  --- @include "removeJobKeys"
18
18
  --- @include "removeParentDependencyKey"
@@ -84,7 +84,7 @@ removeJobWithChildren = function(prefix, meta, jobId, parentKey, options)
84
84
  end
85
85
 
86
86
  local prev = removeJobFromAnyState(prefix, jobId)
87
- removeDeduplicationKey(prefix, jobKey)
87
+ removeDeduplicationKeyIfNeededOnRemoval(prefix, jobKey, jobId)
88
88
  if removeJobKeys(jobKey) > 0 then
89
89
  local maxEvents = getOrSetMaxEvents(meta)
90
90
  rcall("XADD", prefix .. "events", "MAXLEN", "~", maxEvents, "*", "event", "removed",
@@ -3,11 +3,11 @@
3
3
  ]]
4
4
 
5
5
  -- Includes
6
- --- @include "moveParentToWaitIfNeeded"
6
+ --- @include "moveParentToWaitIfNoPendingDependencies"
7
7
 
8
8
  local function updateParentDepsIfNeeded(parentKey, parentQueueKey, parentDependenciesKey,
9
9
  parentId, jobIdKey, returnvalue, timestamp )
10
10
  local processedSet = parentKey .. ":processed"
11
11
  rcall("HSET", processedSet, jobIdKey, returnvalue)
12
- moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey, parentKey, parentId, timestamp)
12
+ moveParentToWaitIfNoPendingDependencies(parentQueueKey, parentDependenciesKey, parentKey, parentId, timestamp)
13
13
  end
@@ -27,9 +27,7 @@ local rcall = redis.call
27
27
  --- @include "includes/batches"
28
28
  --- @include "includes/getTargetQueueList"
29
29
  --- @include "includes/moveChildFromDependenciesIfNeeded"
30
- --- @include "includes/moveParentToWaitIfNeeded"
31
- --- @include "includes/moveParentToWait"
32
- --- @include "includes/removeDeduplicationKeyIfNeeded"
30
+ --- @include "includes/removeDeduplicationKeyIfNeededOnFinalization"
33
31
  --- @include "includes/removeJobsOnFail"
34
32
  --- @include "includes/trimEvents"
35
33
 
@@ -86,7 +84,7 @@ if (#stalling > 0) then
86
84
  local rawParentData = jobAttributes[2]
87
85
  local opts = cjson.decode(rawOpts)
88
86
  rcall("ZADD", failedKey, timestamp, jobId)
89
- removeDeduplicationKeyIfNeeded(queueKeyPrefix, jobAttributes[3])
87
+ removeDeduplicationKeyIfNeededOnFinalization(queueKeyPrefix, jobAttributes[3], jobId)
90
88
 
91
89
  local failedReason = "job stalled more than allowable limit"
92
90
  rcall("HMSET", jobKey, "failedReason", failedReason, "finishedOn", timestamp)
@@ -65,11 +65,9 @@ local rcall = redis.call
65
65
  --- @include "includes/getTargetQueueList"
66
66
  --- @include "includes/moveJobFromPriorityToActive"
67
67
  --- @include "includes/moveChildFromDependenciesIfNeeded"
68
- --- @include "includes/moveParentToWait"
69
- --- @include "includes/moveParentToWaitIfNeeded"
70
68
  --- @include "includes/prepareJobForProcessing"
71
69
  --- @include "includes/promoteDelayedJobs"
72
- --- @include "includes/removeDeduplicationKeyIfNeeded"
70
+ --- @include "includes/removeDeduplicationKeyIfNeededOnFinalization"
73
71
  --- @include "includes/removeJobKeys"
74
72
  --- @include "includes/removeJobsByMaxAge"
75
73
  --- @include "includes/removeJobsByMaxCount"
@@ -132,7 +130,7 @@ if rcall("EXISTS", jobIdKey) == 1 then -- Make sure job exists
132
130
 
133
131
  local prefix = ARGV[7]
134
132
 
135
- removeDeduplicationKeyIfNeeded(prefix, jobAttributes[3])
133
+ removeDeduplicationKeyIfNeededOnFinalization(prefix, jobAttributes[3], jobId)
136
134
 
137
135
  -- If job has a parent we need to
138
136
  -- 1) remove this job id from parents dependencies
@@ -163,9 +161,13 @@ if rcall("EXISTS", jobIdKey) == 1 then -- Make sure job exists
163
161
  local targetSet = KEYS[11]
164
162
  -- Add to complete/failed set
165
163
  rcall("ZADD", targetSet, timestamp, jobId)
166
- rcall("HMSET", jobIdKey, ARGV[3], ARGV[4], "finishedOn", timestamp)
164
+ rcall("HSET", jobIdKey, ARGV[3], ARGV[4], "finishedOn", timestamp)
167
165
  -- "returnvalue" / "failedReason" and "finishedOn"
168
166
 
167
+ if ARGV[5] == "failed" then
168
+ rcall("HDEL", jobIdKey, "defa")
169
+ end
170
+
169
171
  -- Remove old jobs?
170
172
  if maxAge ~= nil then
171
173
  removeJobsByMaxAge(timestamp, maxAge, targetSet, prefix)
@@ -37,9 +37,7 @@ local jobId = ARGV[4]
37
37
 
38
38
  --- Includes
39
39
  --- @include "includes/moveChildFromDependenciesIfNeeded"
40
- --- @include "includes/moveParentToWait"
41
- --- @include "includes/moveParentToWaitIfNeeded"
42
- --- @include "includes/removeDeduplicationKeyIfNeeded"
40
+ --- @include "includes/removeDeduplicationKeyIfNeededOnFinalization"
43
41
  --- @include "includes/removeJobsOnFail"
44
42
  --- @include "includes/removeLock"
45
43
 
@@ -63,7 +61,7 @@ if rcall("EXISTS", jobKey) == 1 then
63
61
  -- TODO: refactor this logic in an include later
64
62
  local jobAttributes = rcall("HMGET", jobKey, "parent", "deid", "opts")
65
63
 
66
- removeDeduplicationKeyIfNeeded(ARGV[5], jobAttributes[2])
64
+ removeDeduplicationKeyIfNeededOnFinalization(ARGV[5], jobAttributes[2], jobId)
67
65
 
68
66
  local failedReason = "children are failed"
69
67
  rcall("ZADD", failedKey, timestamp, jobId)
@@ -161,12 +161,19 @@ end
161
161
  Validate and move or add dependencies to parent.
162
162
  ]]
163
163
  -- Includes
164
+ --[[
165
+ Validate and move parent to a wait status (waiting, delayed or prioritized)
166
+ if no pending dependencies.
167
+ ]]
168
+ -- Includes
164
169
  --[[
165
170
  Validate and move parent to a wait status (waiting, delayed or prioritized) if needed.
166
171
  ]]
172
+ -- Includes
167
173
  --[[
168
- Validate and move parent to a wait status (wait, prioritized or delayed)
174
+ Move parent to a wait status (wait, prioritized or delayed)
169
175
  ]]
176
+ -- Includes
170
177
  --[[
171
178
  Function to add job in target list and add marker if needed.
172
179
  ]]
@@ -237,52 +244,59 @@ local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
237
244
  return waitKey, false
238
245
  end
239
246
  local function moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
240
- local isParentWaitingChildren = rcall("ZREM", parentQueueKey .. ":waiting-children", parentId)
241
- if isParentWaitingChildren > 0 then
242
- local parentWaitKey = parentQueueKey .. ":wait"
243
- local parentPausedKey = parentQueueKey .. ":paused"
244
- local parentActiveKey = parentQueueKey .. ":active"
245
- local parentMetaKey = parentQueueKey .. ":meta"
246
- local parentMarkerKey = parentQueueKey .. ":marker"
247
- local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
248
- local priority = tonumber(jobAttributes[1]) or 0
249
- local delay = tonumber(jobAttributes[2]) or 0
250
- -- ignore dependencies if any left
251
- rcall("HSET", parentKey, "igdp", 1)
252
- if delay > 0 then
253
- local delayedTimestamp = tonumber(timestamp) + delay
254
- local score = delayedTimestamp * 0x1000
255
- local parentDelayedKey = parentQueueKey .. ":delayed"
256
- rcall("ZADD", parentDelayedKey, score, parentId)
257
- rcall("XADD", parentQueueKey .. ":events", "*", "event", "delayed", "jobId", parentId, "delay",
258
- delayedTimestamp)
259
- addDelayMarkerIfNeeded(parentMarkerKey, parentDelayedKey)
247
+ local parentWaitKey = parentQueueKey .. ":wait"
248
+ local parentPausedKey = parentQueueKey .. ":paused"
249
+ local parentActiveKey = parentQueueKey .. ":active"
250
+ local parentMetaKey = parentQueueKey .. ":meta"
251
+ local parentMarkerKey = parentQueueKey .. ":marker"
252
+ local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
253
+ local priority = tonumber(jobAttributes[1]) or 0
254
+ local delay = tonumber(jobAttributes[2]) or 0
255
+ -- ignore dependencies if any left
256
+ rcall("HSET", parentKey, "igdp", 1)
257
+ if delay > 0 then
258
+ local delayedTimestamp = tonumber(timestamp) + delay
259
+ local score = delayedTimestamp * 0x1000
260
+ local parentDelayedKey = parentQueueKey .. ":delayed"
261
+ rcall("ZADD", parentDelayedKey, score, parentId)
262
+ rcall("XADD", parentQueueKey .. ":events", "*", "event", "delayed", "jobId", parentId, "delay",
263
+ delayedTimestamp)
264
+ addDelayMarkerIfNeeded(parentMarkerKey, parentDelayedKey)
265
+ else
266
+ if priority == 0 then
267
+ local parentTarget, isParentPausedOrMaxed = getTargetQueueList(parentMetaKey, parentActiveKey,
268
+ parentWaitKey, parentPausedKey)
269
+ addJobInTargetList(parentTarget, parentMarkerKey, "RPUSH", isParentPausedOrMaxed, parentId)
260
270
  else
261
- if priority == 0 then
262
- local parentTarget, isParentPausedOrMaxed = getTargetQueueList(parentMetaKey, parentActiveKey,
263
- parentWaitKey, parentPausedKey)
264
- addJobInTargetList(parentTarget, parentMarkerKey, "RPUSH", isParentPausedOrMaxed, parentId)
265
- else
266
- local isPausedOrMaxed = isQueuePausedOrMaxed(parentMetaKey, parentActiveKey)
267
- addJobWithPriority(parentMarkerKey, parentQueueKey .. ":prioritized", priority, parentId,
268
- parentQueueKey .. ":pc", isPausedOrMaxed)
269
- end
270
- rcall("XADD", parentQueueKey .. ":events", "*", "event", "waiting", "jobId", parentId, "prev",
271
- "waiting-children")
271
+ local isPausedOrMaxed = isQueuePausedOrMaxed(parentMetaKey, parentActiveKey)
272
+ addJobWithPriority(parentMarkerKey, parentQueueKey .. ":prioritized", priority, parentId,
273
+ parentQueueKey .. ":pc", isPausedOrMaxed)
272
274
  end
275
+ rcall("XADD", parentQueueKey .. ":events", "*", "event", "waiting", "jobId", parentId, "prev",
276
+ "waiting-children")
273
277
  end
274
278
  end
275
- local function moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey, parentKey, parentId, timestamp)
276
- local doNotHavePendingDependencies = rcall("SCARD", parentDependenciesKey) == 0
277
- if doNotHavePendingDependencies then
278
- moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
279
+ local function moveParentToWaitIfNeeded(parentQueueKey, parentKey, parentId, timestamp)
280
+ if rcall("EXISTS", parentKey) == 1 then
281
+ local parentWaitingChildrenKey = parentQueueKey .. ":waiting-children"
282
+ if rcall("ZSCORE", parentWaitingChildrenKey, parentId) then
283
+ rcall("ZREM", parentWaitingChildrenKey, parentId)
284
+ moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
279
285
  end
286
+ end
287
+ end
288
+ local function moveParentToWaitIfNoPendingDependencies(parentQueueKey, parentDependenciesKey, parentKey,
289
+ parentId, timestamp)
290
+ local doNotHavePendingDependencies = rcall("SCARD", parentDependenciesKey) == 0
291
+ if doNotHavePendingDependencies then
292
+ moveParentToWaitIfNeeded(parentQueueKey, parentKey, parentId, timestamp)
293
+ end
280
294
  end
281
295
  local function updateParentDepsIfNeeded(parentKey, parentQueueKey, parentDependenciesKey,
282
296
  parentId, jobIdKey, returnvalue, timestamp )
283
297
  local processedSet = parentKey .. ":processed"
284
298
  rcall("HSET", processedSet, jobIdKey, returnvalue)
285
- moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey, parentKey, parentId, timestamp)
299
+ moveParentToWaitIfNoPendingDependencies(parentQueueKey, parentDependenciesKey, parentKey, parentId, timestamp)
286
300
  end
287
301
  local function updateExistingJobsParent(parentKey, parent, parentData,
288
302
  parentDependenciesKey, completedKey,
@@ -1 +1 @@
1
- {"version":3,"file":"addDelayedJob-6.js","sourceRoot":"","sources":["../../../src/scripts/addDelayedJob-6.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Xf,CAAC;AACW,QAAA,aAAa,GAAG;IAC3B,IAAI,EAAE,eAAe;IACrB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"addDelayedJob-6.js","sourceRoot":"","sources":["../../../src/scripts/addDelayedJob-6.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Yf,CAAC;AACW,QAAA,aAAa,GAAG;IAC3B,IAAI,EAAE,eAAe;IACrB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -241,13 +241,18 @@ end
241
241
  ]]
242
242
  -- Includes
243
243
  --[[
244
- Function to remove deduplication key.
244
+ Function to remove deduplication key if needed
245
+ when a job is being removed.
245
246
  ]]
246
- local function removeDeduplicationKey(prefixKey, jobKey)
247
+ local function removeDeduplicationKeyIfNeededOnRemoval(prefixKey,
248
+ jobKey, jobId)
247
249
  local deduplicationId = rcall("HGET", jobKey, "deid")
248
250
  if deduplicationId then
249
251
  local deduplicationKey = prefixKey .. "de:" .. deduplicationId
250
- rcall("DEL", deduplicationKey)
252
+ local currentJobId = rcall('GET', deduplicationKey)
253
+ if currentJobId and currentJobId == jobId then
254
+ return rcall("DEL", deduplicationKey)
255
+ end
251
256
  end
252
257
  end
253
258
  --[[
@@ -349,7 +354,7 @@ local function removeJob(jobId, hard, baseKey, shouldRemoveDeduplicationKey)
349
354
  local jobKey = baseKey .. jobId
350
355
  removeParentDependencyKey(jobKey, hard, nil, baseKey)
351
356
  if shouldRemoveDeduplicationKey then
352
- removeDeduplicationKey(baseKey, jobKey)
357
+ removeDeduplicationKeyIfNeededOnRemoval(baseKey, jobKey, jobId)
353
358
  end
354
359
  removeJobKeys(jobKey)
355
360
  end
@@ -1 +1 @@
1
- {"version":3,"file":"addJobScheduler-11.js","sourceRoot":"","sources":["../../../src/scripts/addJobScheduler-11.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkcf,CAAC;AACW,QAAA,eAAe,GAAG;IAC7B,IAAI,EAAE,iBAAiB;IACvB,OAAO;IACP,IAAI,EAAE,EAAE;CACT,CAAC"}
1
+ {"version":3,"file":"addJobScheduler-11.js","sourceRoot":"","sources":["../../../src/scripts/addJobScheduler-11.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAucf,CAAC;AACW,QAAA,eAAe,GAAG;IAC7B,IAAI,EAAE,iBAAiB;IACvB,OAAO;IACP,IAAI,EAAE,EAAE;CACT,CAAC"}
@@ -93,12 +93,19 @@ end
93
93
  Validate and move or add dependencies to parent.
94
94
  ]]
95
95
  -- Includes
96
+ --[[
97
+ Validate and move parent to a wait status (waiting, delayed or prioritized)
98
+ if no pending dependencies.
99
+ ]]
100
+ -- Includes
96
101
  --[[
97
102
  Validate and move parent to a wait status (waiting, delayed or prioritized) if needed.
98
103
  ]]
104
+ -- Includes
99
105
  --[[
100
- Validate and move parent to a wait status (wait, prioritized or delayed)
106
+ Move parent to a wait status (wait, prioritized or delayed)
101
107
  ]]
108
+ -- Includes
102
109
  --[[
103
110
  Add delay marker if needed.
104
111
  ]]
@@ -193,52 +200,59 @@ local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
193
200
  return waitKey, false
194
201
  end
195
202
  local function moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
196
- local isParentWaitingChildren = rcall("ZREM", parentQueueKey .. ":waiting-children", parentId)
197
- if isParentWaitingChildren > 0 then
198
- local parentWaitKey = parentQueueKey .. ":wait"
199
- local parentPausedKey = parentQueueKey .. ":paused"
200
- local parentActiveKey = parentQueueKey .. ":active"
201
- local parentMetaKey = parentQueueKey .. ":meta"
202
- local parentMarkerKey = parentQueueKey .. ":marker"
203
- local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
204
- local priority = tonumber(jobAttributes[1]) or 0
205
- local delay = tonumber(jobAttributes[2]) or 0
206
- -- ignore dependencies if any left
207
- rcall("HSET", parentKey, "igdp", 1)
208
- if delay > 0 then
209
- local delayedTimestamp = tonumber(timestamp) + delay
210
- local score = delayedTimestamp * 0x1000
211
- local parentDelayedKey = parentQueueKey .. ":delayed"
212
- rcall("ZADD", parentDelayedKey, score, parentId)
213
- rcall("XADD", parentQueueKey .. ":events", "*", "event", "delayed", "jobId", parentId, "delay",
214
- delayedTimestamp)
215
- addDelayMarkerIfNeeded(parentMarkerKey, parentDelayedKey)
203
+ local parentWaitKey = parentQueueKey .. ":wait"
204
+ local parentPausedKey = parentQueueKey .. ":paused"
205
+ local parentActiveKey = parentQueueKey .. ":active"
206
+ local parentMetaKey = parentQueueKey .. ":meta"
207
+ local parentMarkerKey = parentQueueKey .. ":marker"
208
+ local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
209
+ local priority = tonumber(jobAttributes[1]) or 0
210
+ local delay = tonumber(jobAttributes[2]) or 0
211
+ -- ignore dependencies if any left
212
+ rcall("HSET", parentKey, "igdp", 1)
213
+ if delay > 0 then
214
+ local delayedTimestamp = tonumber(timestamp) + delay
215
+ local score = delayedTimestamp * 0x1000
216
+ local parentDelayedKey = parentQueueKey .. ":delayed"
217
+ rcall("ZADD", parentDelayedKey, score, parentId)
218
+ rcall("XADD", parentQueueKey .. ":events", "*", "event", "delayed", "jobId", parentId, "delay",
219
+ delayedTimestamp)
220
+ addDelayMarkerIfNeeded(parentMarkerKey, parentDelayedKey)
221
+ else
222
+ if priority == 0 then
223
+ local parentTarget, isParentPausedOrMaxed = getTargetQueueList(parentMetaKey, parentActiveKey,
224
+ parentWaitKey, parentPausedKey)
225
+ addJobInTargetList(parentTarget, parentMarkerKey, "RPUSH", isParentPausedOrMaxed, parentId)
216
226
  else
217
- if priority == 0 then
218
- local parentTarget, isParentPausedOrMaxed = getTargetQueueList(parentMetaKey, parentActiveKey,
219
- parentWaitKey, parentPausedKey)
220
- addJobInTargetList(parentTarget, parentMarkerKey, "RPUSH", isParentPausedOrMaxed, parentId)
221
- else
222
- local isPausedOrMaxed = isQueuePausedOrMaxed(parentMetaKey, parentActiveKey)
223
- addJobWithPriority(parentMarkerKey, parentQueueKey .. ":prioritized", priority, parentId,
224
- parentQueueKey .. ":pc", isPausedOrMaxed)
225
- end
226
- rcall("XADD", parentQueueKey .. ":events", "*", "event", "waiting", "jobId", parentId, "prev",
227
- "waiting-children")
227
+ local isPausedOrMaxed = isQueuePausedOrMaxed(parentMetaKey, parentActiveKey)
228
+ addJobWithPriority(parentMarkerKey, parentQueueKey .. ":prioritized", priority, parentId,
229
+ parentQueueKey .. ":pc", isPausedOrMaxed)
228
230
  end
231
+ rcall("XADD", parentQueueKey .. ":events", "*", "event", "waiting", "jobId", parentId, "prev",
232
+ "waiting-children")
229
233
  end
230
234
  end
231
- local function moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey, parentKey, parentId, timestamp)
232
- local doNotHavePendingDependencies = rcall("SCARD", parentDependenciesKey) == 0
233
- if doNotHavePendingDependencies then
234
- moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
235
+ local function moveParentToWaitIfNeeded(parentQueueKey, parentKey, parentId, timestamp)
236
+ if rcall("EXISTS", parentKey) == 1 then
237
+ local parentWaitingChildrenKey = parentQueueKey .. ":waiting-children"
238
+ if rcall("ZSCORE", parentWaitingChildrenKey, parentId) then
239
+ rcall("ZREM", parentWaitingChildrenKey, parentId)
240
+ moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
235
241
  end
242
+ end
243
+ end
244
+ local function moveParentToWaitIfNoPendingDependencies(parentQueueKey, parentDependenciesKey, parentKey,
245
+ parentId, timestamp)
246
+ local doNotHavePendingDependencies = rcall("SCARD", parentDependenciesKey) == 0
247
+ if doNotHavePendingDependencies then
248
+ moveParentToWaitIfNeeded(parentQueueKey, parentKey, parentId, timestamp)
249
+ end
236
250
  end
237
251
  local function updateParentDepsIfNeeded(parentKey, parentQueueKey, parentDependenciesKey,
238
252
  parentId, jobIdKey, returnvalue, timestamp )
239
253
  local processedSet = parentKey .. ":processed"
240
254
  rcall("HSET", processedSet, jobIdKey, returnvalue)
241
- moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey, parentKey, parentId, timestamp)
255
+ moveParentToWaitIfNoPendingDependencies(parentQueueKey, parentDependenciesKey, parentKey, parentId, timestamp)
242
256
  end
243
257
  local function updateExistingJobsParent(parentKey, parent, parentData,
244
258
  parentDependenciesKey, completedKey,
@@ -1 +1 @@
1
- {"version":3,"file":"addParentJob-4.js","sourceRoot":"","sources":["../../../src/scripts/addParentJob-4.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoVf,CAAC;AACW,QAAA,YAAY,GAAG;IAC1B,IAAI,EAAE,cAAc;IACpB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"addParentJob-4.js","sourceRoot":"","sources":["../../../src/scripts/addParentJob-4.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkWf,CAAC;AACW,QAAA,YAAY,GAAG;IAC1B,IAAI,EAAE,cAAc;IACpB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -155,12 +155,19 @@ end
155
155
  Validate and move or add dependencies to parent.
156
156
  ]]
157
157
  -- Includes
158
+ --[[
159
+ Validate and move parent to a wait status (waiting, delayed or prioritized)
160
+ if no pending dependencies.
161
+ ]]
162
+ -- Includes
158
163
  --[[
159
164
  Validate and move parent to a wait status (waiting, delayed or prioritized) if needed.
160
165
  ]]
166
+ -- Includes
161
167
  --[[
162
- Validate and move parent to a wait status (wait, prioritized or delayed)
168
+ Move parent to a wait status (wait, prioritized or delayed)
163
169
  ]]
170
+ -- Includes
164
171
  --[[
165
172
  Add delay marker if needed.
166
173
  ]]
@@ -230,52 +237,59 @@ local function getTargetQueueList(queueMetaKey, activeKey, waitKey, pausedKey)
230
237
  return waitKey, false
231
238
  end
232
239
  local function moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
233
- local isParentWaitingChildren = rcall("ZREM", parentQueueKey .. ":waiting-children", parentId)
234
- if isParentWaitingChildren > 0 then
235
- local parentWaitKey = parentQueueKey .. ":wait"
236
- local parentPausedKey = parentQueueKey .. ":paused"
237
- local parentActiveKey = parentQueueKey .. ":active"
238
- local parentMetaKey = parentQueueKey .. ":meta"
239
- local parentMarkerKey = parentQueueKey .. ":marker"
240
- local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
241
- local priority = tonumber(jobAttributes[1]) or 0
242
- local delay = tonumber(jobAttributes[2]) or 0
243
- -- ignore dependencies if any left
244
- rcall("HSET", parentKey, "igdp", 1)
245
- if delay > 0 then
246
- local delayedTimestamp = tonumber(timestamp) + delay
247
- local score = delayedTimestamp * 0x1000
248
- local parentDelayedKey = parentQueueKey .. ":delayed"
249
- rcall("ZADD", parentDelayedKey, score, parentId)
250
- rcall("XADD", parentQueueKey .. ":events", "*", "event", "delayed", "jobId", parentId, "delay",
251
- delayedTimestamp)
252
- addDelayMarkerIfNeeded(parentMarkerKey, parentDelayedKey)
240
+ local parentWaitKey = parentQueueKey .. ":wait"
241
+ local parentPausedKey = parentQueueKey .. ":paused"
242
+ local parentActiveKey = parentQueueKey .. ":active"
243
+ local parentMetaKey = parentQueueKey .. ":meta"
244
+ local parentMarkerKey = parentQueueKey .. ":marker"
245
+ local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
246
+ local priority = tonumber(jobAttributes[1]) or 0
247
+ local delay = tonumber(jobAttributes[2]) or 0
248
+ -- ignore dependencies if any left
249
+ rcall("HSET", parentKey, "igdp", 1)
250
+ if delay > 0 then
251
+ local delayedTimestamp = tonumber(timestamp) + delay
252
+ local score = delayedTimestamp * 0x1000
253
+ local parentDelayedKey = parentQueueKey .. ":delayed"
254
+ rcall("ZADD", parentDelayedKey, score, parentId)
255
+ rcall("XADD", parentQueueKey .. ":events", "*", "event", "delayed", "jobId", parentId, "delay",
256
+ delayedTimestamp)
257
+ addDelayMarkerIfNeeded(parentMarkerKey, parentDelayedKey)
258
+ else
259
+ if priority == 0 then
260
+ local parentTarget, isParentPausedOrMaxed = getTargetQueueList(parentMetaKey, parentActiveKey,
261
+ parentWaitKey, parentPausedKey)
262
+ addJobInTargetList(parentTarget, parentMarkerKey, "RPUSH", isParentPausedOrMaxed, parentId)
253
263
  else
254
- if priority == 0 then
255
- local parentTarget, isParentPausedOrMaxed = getTargetQueueList(parentMetaKey, parentActiveKey,
256
- parentWaitKey, parentPausedKey)
257
- addJobInTargetList(parentTarget, parentMarkerKey, "RPUSH", isParentPausedOrMaxed, parentId)
258
- else
259
- local isPausedOrMaxed = isQueuePausedOrMaxed(parentMetaKey, parentActiveKey)
260
- addJobWithPriority(parentMarkerKey, parentQueueKey .. ":prioritized", priority, parentId,
261
- parentQueueKey .. ":pc", isPausedOrMaxed)
262
- end
263
- rcall("XADD", parentQueueKey .. ":events", "*", "event", "waiting", "jobId", parentId, "prev",
264
- "waiting-children")
264
+ local isPausedOrMaxed = isQueuePausedOrMaxed(parentMetaKey, parentActiveKey)
265
+ addJobWithPriority(parentMarkerKey, parentQueueKey .. ":prioritized", priority, parentId,
266
+ parentQueueKey .. ":pc", isPausedOrMaxed)
265
267
  end
268
+ rcall("XADD", parentQueueKey .. ":events", "*", "event", "waiting", "jobId", parentId, "prev",
269
+ "waiting-children")
266
270
  end
267
271
  end
268
- local function moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey, parentKey, parentId, timestamp)
269
- local doNotHavePendingDependencies = rcall("SCARD", parentDependenciesKey) == 0
270
- if doNotHavePendingDependencies then
271
- moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
272
+ local function moveParentToWaitIfNeeded(parentQueueKey, parentKey, parentId, timestamp)
273
+ if rcall("EXISTS", parentKey) == 1 then
274
+ local parentWaitingChildrenKey = parentQueueKey .. ":waiting-children"
275
+ if rcall("ZSCORE", parentWaitingChildrenKey, parentId) then
276
+ rcall("ZREM", parentWaitingChildrenKey, parentId)
277
+ moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
272
278
  end
279
+ end
280
+ end
281
+ local function moveParentToWaitIfNoPendingDependencies(parentQueueKey, parentDependenciesKey, parentKey,
282
+ parentId, timestamp)
283
+ local doNotHavePendingDependencies = rcall("SCARD", parentDependenciesKey) == 0
284
+ if doNotHavePendingDependencies then
285
+ moveParentToWaitIfNeeded(parentQueueKey, parentKey, parentId, timestamp)
286
+ end
273
287
  end
274
288
  local function updateParentDepsIfNeeded(parentKey, parentQueueKey, parentDependenciesKey,
275
289
  parentId, jobIdKey, returnvalue, timestamp )
276
290
  local processedSet = parentKey .. ":processed"
277
291
  rcall("HSET", processedSet, jobIdKey, returnvalue)
278
- moveParentToWaitIfNeeded(parentQueueKey, parentDependenciesKey, parentKey, parentId, timestamp)
292
+ moveParentToWaitIfNoPendingDependencies(parentQueueKey, parentDependenciesKey, parentKey, parentId, timestamp)
279
293
  end
280
294
  local function updateExistingJobsParent(parentKey, parent, parentData,
281
295
  parentDependenciesKey, completedKey,
@@ -1 +1 @@
1
- {"version":3,"file":"addPrioritizedJob-8.js","sourceRoot":"","sources":["../../../src/scripts/addPrioritizedJob-8.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Vf,CAAC;AACW,QAAA,iBAAiB,GAAG;IAC/B,IAAI,EAAE,mBAAmB;IACzB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"addPrioritizedJob-8.js","sourceRoot":"","sources":["../../../src/scripts/addPrioritizedJob-8.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Wf,CAAC;AACW,QAAA,iBAAiB,GAAG;IAC/B,IAAI,EAAE,mBAAmB;IACzB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}