bullmq 5.1.11 → 5.2.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 (63) hide show
  1. package/dist/cjs/classes/job.js +10 -0
  2. package/dist/cjs/classes/job.js.map +1 -1
  3. package/dist/cjs/classes/redis-connection.js +9 -1
  4. package/dist/cjs/classes/redis-connection.js.map +1 -1
  5. package/dist/cjs/classes/scripts.js +3 -2
  6. package/dist/cjs/classes/scripts.js.map +1 -1
  7. package/dist/cjs/commands/addDelayedJob-6.lua +1 -2
  8. package/dist/cjs/commands/addParentJob-4.lua +0 -1
  9. package/dist/cjs/commands/addPrioritizedJob-7.lua +0 -1
  10. package/dist/cjs/commands/addStandardJob-7.lua +0 -1
  11. package/dist/cjs/commands/includes/handleDuplicatedJob.lua +1 -1
  12. package/dist/cjs/commands/includes/removeJob.lua +2 -2
  13. package/dist/cjs/commands/includes/removeJobKeys.lua +8 -0
  14. package/dist/cjs/commands/includes/removeParentDependencyKey.lua +4 -5
  15. package/dist/cjs/commands/moveToFinished-14.lua +6 -1
  16. package/dist/cjs/commands/removeJob-1.lua +12 -1
  17. package/dist/cjs/scripts/addDelayedJob-6.js +1 -1
  18. package/dist/cjs/scripts/cleanJobsInSet-2.js +11 -7
  19. package/dist/cjs/scripts/cleanJobsInSet-2.js.map +1 -1
  20. package/dist/cjs/scripts/drain-4.js +11 -7
  21. package/dist/cjs/scripts/drain-4.js.map +1 -1
  22. package/dist/cjs/scripts/moveStalledJobsToWait-9.js +11 -7
  23. package/dist/cjs/scripts/moveStalledJobsToWait-9.js.map +1 -1
  24. package/dist/cjs/scripts/moveToFinished-14.js +17 -8
  25. package/dist/cjs/scripts/moveToFinished-14.js.map +1 -1
  26. package/dist/cjs/scripts/obliterate-2.js +11 -7
  27. package/dist/cjs/scripts/obliterate-2.js.map +1 -1
  28. package/dist/cjs/scripts/removeJob-1.js +19 -6
  29. package/dist/cjs/scripts/removeJob-1.js.map +1 -1
  30. package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
  31. package/dist/esm/classes/job.d.ts +9 -1
  32. package/dist/esm/classes/job.js +10 -0
  33. package/dist/esm/classes/job.js.map +1 -1
  34. package/dist/esm/classes/redis-connection.js +9 -1
  35. package/dist/esm/classes/redis-connection.js.map +1 -1
  36. package/dist/esm/classes/scripts.js +3 -2
  37. package/dist/esm/classes/scripts.js.map +1 -1
  38. package/dist/esm/commands/addDelayedJob-6.lua +1 -2
  39. package/dist/esm/commands/addParentJob-4.lua +0 -1
  40. package/dist/esm/commands/addPrioritizedJob-7.lua +0 -1
  41. package/dist/esm/commands/addStandardJob-7.lua +0 -1
  42. package/dist/esm/commands/includes/handleDuplicatedJob.lua +1 -1
  43. package/dist/esm/commands/includes/removeJob.lua +2 -2
  44. package/dist/esm/commands/includes/removeJobKeys.lua +8 -0
  45. package/dist/esm/commands/includes/removeParentDependencyKey.lua +4 -5
  46. package/dist/esm/commands/moveToFinished-14.lua +6 -1
  47. package/dist/esm/commands/removeJob-1.lua +12 -1
  48. package/dist/esm/scripts/addDelayedJob-6.js +1 -1
  49. package/dist/esm/scripts/cleanJobsInSet-2.js +11 -7
  50. package/dist/esm/scripts/cleanJobsInSet-2.js.map +1 -1
  51. package/dist/esm/scripts/drain-4.js +11 -7
  52. package/dist/esm/scripts/drain-4.js.map +1 -1
  53. package/dist/esm/scripts/moveStalledJobsToWait-9.js +11 -7
  54. package/dist/esm/scripts/moveStalledJobsToWait-9.js.map +1 -1
  55. package/dist/esm/scripts/moveToFinished-14.js +17 -8
  56. package/dist/esm/scripts/moveToFinished-14.js.map +1 -1
  57. package/dist/esm/scripts/obliterate-2.js +11 -7
  58. package/dist/esm/scripts/obliterate-2.js.map +1 -1
  59. package/dist/esm/scripts/removeJob-1.js +19 -6
  60. package/dist/esm/scripts/removeJob-1.js.map +1 -1
  61. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  62. package/dist/esm/types/job-options.d.ts +8 -0
  63. package/package.json +1 -1
@@ -25,6 +25,13 @@ local queueBaseKey = ARGV[1]
25
25
  Function to remove job.
26
26
  ]]
27
27
  -- Includes
28
+ --[[
29
+ Function to remove job keys.
30
+ ]]
31
+ local function removeJobKeys(jobKey)
32
+ return rcall("DEL", jobKey, jobKey .. ':logs',
33
+ jobKey .. ':dependencies', jobKey .. ':processed', jobKey .. ':failed')
34
+ end
28
35
  --[[
29
36
  Check if this job has a parent. If so we will just remove it from
30
37
  the parent child list, but if it is the last child we should move the parent to "wait/paused"
@@ -88,11 +95,10 @@ local function removeParentDependencyKey(jobKey, hard, parentKey, baseKey)
88
95
  local parentPrefix = getJobKeyPrefix(parentKey, parentId)
89
96
  local numRemovedElements = rcall("ZREM", parentPrefix .. "waiting-children", parentId)
90
97
  if numRemovedElements == 1 then
91
- if hard then
98
+ if hard then -- remove parent in same queue
92
99
  if parentPrefix == baseKey then
93
100
  removeParentDependencyKey(parentKey, hard, nil, baseKey)
94
- rcall("DEL", parentKey, parentKey .. ':logs',
95
- parentKey .. ':dependencies', parentKey .. ':processed')
101
+ removeJobKeys(parentKey)
96
102
  else
97
103
  moveParentToWait(parentPrefix, parentId)
98
104
  end
@@ -118,8 +124,7 @@ local function removeParentDependencyKey(jobKey, hard, parentKey, baseKey)
118
124
  if hard then
119
125
  if parentPrefix == baseKey then
120
126
  removeParentDependencyKey(missedParentKey, hard, nil, baseKey)
121
- rcall("DEL", missedParentKey, missedParentKey .. ':logs',
122
- missedParentKey .. ':dependencies', missedParentKey .. ':processed')
127
+ removeJobKeys(missedParentKey)
123
128
  else
124
129
  moveParentToWait(parentPrefix, parentId)
125
130
  end
@@ -135,8 +140,7 @@ end
135
140
  local function removeJob(jobId, hard, baseKey)
136
141
  local jobKey = baseKey .. jobId
137
142
  removeParentDependencyKey(jobKey, hard, nil, baseKey)
138
- rcall("DEL", jobKey, jobKey .. ':logs',
139
- jobKey .. ':dependencies', jobKey .. ':processed')
143
+ removeJobKeys(jobKey)
140
144
  end
141
145
  local function removeJobs(keys, hard, baseKey, max)
142
146
  for i, key in ipairs(keys) do
@@ -1 +1 @@
1
- {"version":3,"file":"drain-4.js","sourceRoot":"","sources":["../../../src/scripts/drain-4.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Lf,CAAC;AACW,QAAA,KAAK,GAAG;IACnB,IAAI,EAAE,OAAO;IACb,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"drain-4.js","sourceRoot":"","sources":["../../../src/scripts/drain-4.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmMf,CAAC;AACW,QAAA,KAAK,GAAG;IACnB,IAAI,EAAE,OAAO;IACb,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -69,6 +69,13 @@ end
69
69
  Function to remove job.
70
70
  ]]
71
71
  -- Includes
72
+ --[[
73
+ Function to remove job keys.
74
+ ]]
75
+ local function removeJobKeys(jobKey)
76
+ return rcall("DEL", jobKey, jobKey .. ':logs',
77
+ jobKey .. ':dependencies', jobKey .. ':processed', jobKey .. ':failed')
78
+ end
72
79
  --[[
73
80
  Check if this job has a parent. If so we will just remove it from
74
81
  the parent child list, but if it is the last child we should move the parent to "wait/paused"
@@ -105,11 +112,10 @@ local function removeParentDependencyKey(jobKey, hard, parentKey, baseKey)
105
112
  local parentPrefix = getJobKeyPrefix(parentKey, parentId)
106
113
  local numRemovedElements = rcall("ZREM", parentPrefix .. "waiting-children", parentId)
107
114
  if numRemovedElements == 1 then
108
- if hard then
115
+ if hard then -- remove parent in same queue
109
116
  if parentPrefix == baseKey then
110
117
  removeParentDependencyKey(parentKey, hard, nil, baseKey)
111
- rcall("DEL", parentKey, parentKey .. ':logs',
112
- parentKey .. ':dependencies', parentKey .. ':processed')
118
+ removeJobKeys(parentKey)
113
119
  else
114
120
  moveParentToWait(parentPrefix, parentId)
115
121
  end
@@ -135,8 +141,7 @@ local function removeParentDependencyKey(jobKey, hard, parentKey, baseKey)
135
141
  if hard then
136
142
  if parentPrefix == baseKey then
137
143
  removeParentDependencyKey(missedParentKey, hard, nil, baseKey)
138
- rcall("DEL", missedParentKey, missedParentKey .. ':logs',
139
- missedParentKey .. ':dependencies', missedParentKey .. ':processed')
144
+ removeJobKeys(missedParentKey)
140
145
  else
141
146
  moveParentToWait(parentPrefix, parentId)
142
147
  end
@@ -152,8 +157,7 @@ end
152
157
  local function removeJob(jobId, hard, baseKey)
153
158
  local jobKey = baseKey .. jobId
154
159
  removeParentDependencyKey(jobKey, hard, nil, baseKey)
155
- rcall("DEL", jobKey, jobKey .. ':logs',
156
- jobKey .. ':dependencies', jobKey .. ':processed')
160
+ removeJobKeys(jobKey)
157
161
  end
158
162
  --[[
159
163
  Functions to remove jobs by max age.
@@ -1 +1 @@
1
- {"version":3,"file":"moveStalledJobsToWait-9.js","sourceRoot":"","sources":["../../../src/scripts/moveStalledJobsToWait-9.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA0SS,CAAC;AACb,QAAA,qBAAqB,GAAG;IACnC,IAAI,EAAE,uBAAuB;IAC7B,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"moveStalledJobsToWait-9.js","sourceRoot":"","sources":["../../../src/scripts/moveStalledJobsToWait-9.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA8SS,CAAC;AACb,QAAA,qBAAqB,GAAG;IACnC,IAAI,EAAE,uBAAuB;IAC7B,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -36,6 +36,7 @@ const content = `--[[
36
36
  opts - attempts max attempts
37
37
  opts - maxMetricsSize
38
38
  opts - fpof - fail parent on fail
39
+ opts - idof - ignore dependency on fail
39
40
  opts - rdof - remove dependency on fail
40
41
  Output:
41
42
  0 OK
@@ -327,6 +328,13 @@ end
327
328
  Function to remove job.
328
329
  ]]
329
330
  -- Includes
331
+ --[[
332
+ Function to remove job keys.
333
+ ]]
334
+ local function removeJobKeys(jobKey)
335
+ return rcall("DEL", jobKey, jobKey .. ':logs',
336
+ jobKey .. ':dependencies', jobKey .. ':processed', jobKey .. ':failed')
337
+ end
330
338
  --[[
331
339
  Check if this job has a parent. If so we will just remove it from
332
340
  the parent child list, but if it is the last child we should move the parent to "wait/paused"
@@ -363,11 +371,10 @@ local function removeParentDependencyKey(jobKey, hard, parentKey, baseKey)
363
371
  local parentPrefix = getJobKeyPrefix(parentKey, parentId)
364
372
  local numRemovedElements = rcall("ZREM", parentPrefix .. "waiting-children", parentId)
365
373
  if numRemovedElements == 1 then
366
- if hard then
374
+ if hard then -- remove parent in same queue
367
375
  if parentPrefix == baseKey then
368
376
  removeParentDependencyKey(parentKey, hard, nil, baseKey)
369
- rcall("DEL", parentKey, parentKey .. ':logs',
370
- parentKey .. ':dependencies', parentKey .. ':processed')
377
+ removeJobKeys(parentKey)
371
378
  else
372
379
  moveParentToWait(parentPrefix, parentId)
373
380
  end
@@ -393,8 +400,7 @@ local function removeParentDependencyKey(jobKey, hard, parentKey, baseKey)
393
400
  if hard then
394
401
  if parentPrefix == baseKey then
395
402
  removeParentDependencyKey(missedParentKey, hard, nil, baseKey)
396
- rcall("DEL", missedParentKey, missedParentKey .. ':logs',
397
- missedParentKey .. ':dependencies', missedParentKey .. ':processed')
403
+ removeJobKeys(missedParentKey)
398
404
  else
399
405
  moveParentToWait(parentPrefix, parentId)
400
406
  end
@@ -410,8 +416,7 @@ end
410
416
  local function removeJob(jobId, hard, baseKey)
411
417
  local jobKey = baseKey .. jobId
412
418
  removeParentDependencyKey(jobKey, hard, nil, baseKey)
413
- rcall("DEL", jobKey, jobKey .. ':logs',
414
- jobKey .. ':dependencies', jobKey .. ':processed')
419
+ removeJobKeys(jobKey)
415
420
  end
416
421
  local function removeJobsByMaxAge(timestamp, maxAge, targetSet, prefix)
417
422
  local start = timestamp - maxAge * 1000
@@ -548,11 +553,15 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
548
553
  moveParentFromWaitingChildrenToFailed(parentQueueKey, parentKey,
549
554
  parentId, jobIdKey,
550
555
  timestamp)
551
- elseif opts['rdof'] then
556
+ elseif opts['idof'] or opts['rdof'] then
552
557
  local dependenciesSet = parentKey .. ":dependencies"
553
558
  if rcall("SREM", dependenciesSet, jobIdKey) == 1 then
554
559
  moveParentToWaitIfNeeded(parentQueueKey, dependenciesSet,
555
560
  parentKey, parentId, timestamp)
561
+ if opts['idof'] then
562
+ local failedSet = parentKey .. ":failed"
563
+ rcall("HSET", failedSet, jobIdKey, ARGV[4])
564
+ end
556
565
  end
557
566
  end
558
567
  end
@@ -1 +1 @@
1
- {"version":3,"file":"moveToFinished-14.js","sourceRoot":"","sources":["../../../src/scripts/moveToFinished-14.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4oBf,CAAC;AACW,QAAA,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,EAAE;CACT,CAAC"}
1
+ {"version":3,"file":"moveToFinished-14.js","sourceRoot":"","sources":["../../../src/scripts/moveToFinished-14.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqpBf,CAAC;AACW,QAAA,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,EAAE;CACT,CAAC"}
@@ -27,6 +27,13 @@ local rcall = redis.call
27
27
  Function to remove job.
28
28
  ]]
29
29
  -- Includes
30
+ --[[
31
+ Function to remove job keys.
32
+ ]]
33
+ local function removeJobKeys(jobKey)
34
+ return rcall("DEL", jobKey, jobKey .. ':logs',
35
+ jobKey .. ':dependencies', jobKey .. ':processed', jobKey .. ':failed')
36
+ end
30
37
  --[[
31
38
  Check if this job has a parent. If so we will just remove it from
32
39
  the parent child list, but if it is the last child we should move the parent to "wait/paused"
@@ -90,11 +97,10 @@ local function removeParentDependencyKey(jobKey, hard, parentKey, baseKey)
90
97
  local parentPrefix = getJobKeyPrefix(parentKey, parentId)
91
98
  local numRemovedElements = rcall("ZREM", parentPrefix .. "waiting-children", parentId)
92
99
  if numRemovedElements == 1 then
93
- if hard then
100
+ if hard then -- remove parent in same queue
94
101
  if parentPrefix == baseKey then
95
102
  removeParentDependencyKey(parentKey, hard, nil, baseKey)
96
- rcall("DEL", parentKey, parentKey .. ':logs',
97
- parentKey .. ':dependencies', parentKey .. ':processed')
103
+ removeJobKeys(parentKey)
98
104
  else
99
105
  moveParentToWait(parentPrefix, parentId)
100
106
  end
@@ -120,8 +126,7 @@ local function removeParentDependencyKey(jobKey, hard, parentKey, baseKey)
120
126
  if hard then
121
127
  if parentPrefix == baseKey then
122
128
  removeParentDependencyKey(missedParentKey, hard, nil, baseKey)
123
- rcall("DEL", missedParentKey, missedParentKey .. ':logs',
124
- missedParentKey .. ':dependencies', missedParentKey .. ':processed')
129
+ removeJobKeys(missedParentKey)
125
130
  else
126
131
  moveParentToWait(parentPrefix, parentId)
127
132
  end
@@ -137,8 +142,7 @@ end
137
142
  local function removeJob(jobId, hard, baseKey)
138
143
  local jobKey = baseKey .. jobId
139
144
  removeParentDependencyKey(jobKey, hard, nil, baseKey)
140
- rcall("DEL", jobKey, jobKey .. ':logs',
141
- jobKey .. ':dependencies', jobKey .. ':processed')
145
+ removeJobKeys(jobKey)
142
146
  end
143
147
  local function removeJobs(keys, hard, baseKey, max)
144
148
  for i, key in ipairs(keys) do
@@ -1 +1 @@
1
- {"version":3,"file":"obliterate-2.js","sourceRoot":"","sources":["../../../src/scripts/obliterate-2.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiQf,CAAC;AACW,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE,YAAY;IAClB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"obliterate-2.js","sourceRoot":"","sources":["../../../src/scripts/obliterate-2.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqQf,CAAC;AACW,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE,YAAY;IAClB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
@@ -96,6 +96,13 @@ local function removeJobFromAnyState( prefix, jobId)
96
96
  end
97
97
  return "unknown"
98
98
  end
99
+ --[[
100
+ Function to remove job keys.
101
+ ]]
102
+ local function removeJobKeys(jobKey)
103
+ return rcall("DEL", jobKey, jobKey .. ':logs',
104
+ jobKey .. ':dependencies', jobKey .. ':processed', jobKey .. ':failed')
105
+ end
99
106
  --[[
100
107
  Check if this job has a parent. If so we will just remove it from
101
108
  the parent child list, but if it is the last child we should move the parent to "wait/paused"
@@ -149,11 +156,10 @@ local function removeParentDependencyKey(jobKey, hard, parentKey, baseKey)
149
156
  local parentPrefix = getJobKeyPrefix(parentKey, parentId)
150
157
  local numRemovedElements = rcall("ZREM", parentPrefix .. "waiting-children", parentId)
151
158
  if numRemovedElements == 1 then
152
- if hard then
159
+ if hard then -- remove parent in same queue
153
160
  if parentPrefix == baseKey then
154
161
  removeParentDependencyKey(parentKey, hard, nil, baseKey)
155
- rcall("DEL", parentKey, parentKey .. ':logs',
156
- parentKey .. ':dependencies', parentKey .. ':processed')
162
+ removeJobKeys(parentKey)
157
163
  else
158
164
  moveParentToWait(parentPrefix, parentId)
159
165
  end
@@ -179,8 +185,7 @@ local function removeParentDependencyKey(jobKey, hard, parentKey, baseKey)
179
185
  if hard then
180
186
  if parentPrefix == baseKey then
181
187
  removeParentDependencyKey(missedParentKey, hard, nil, baseKey)
182
- rcall("DEL", missedParentKey, missedParentKey .. ':logs',
183
- missedParentKey .. ':dependencies', missedParentKey .. ':processed')
188
+ removeJobKeys(missedParentKey)
184
189
  else
185
190
  moveParentToWait(parentPrefix, parentId)
186
191
  end
@@ -218,9 +223,17 @@ local function removeJob( prefix, jobId, parentKey, removeChildren)
218
223
  removeJob( childJobPrefix, childJobId, jobKey, removeChildren )
219
224
  end
220
225
  end
226
+ local failed = rcall("HGETALL", jobKey .. ":failed")
227
+ if (#failed > 0) then
228
+ for i = 1, #failed, 2 do
229
+ local childJobId = getJobIdFromKey(failed[i])
230
+ local childJobPrefix = getJobKeyPrefix(failed[i], childJobId)
231
+ removeJob( childJobPrefix, childJobId, jobKey, removeChildren )
232
+ end
233
+ end
221
234
  end
222
235
  local prev = removeJobFromAnyState(prefix, jobId)
223
- if rcall("DEL", jobKey, jobKey .. ":logs", jobKey .. ":dependencies", jobKey .. ":processed") > 0 then
236
+ if removeJobKeys(jobKey) > 0 then
224
237
  local maxEvents = getOrSetMaxEvents(prefix .. "meta")
225
238
  rcall("XADD", prefix .. "events", "MAXLEN", "~", maxEvents, "*", "event", "removed",
226
239
  "jobId", jobId, "prev", prev)
@@ -1 +1 @@
1
- {"version":3,"file":"removeJob-1.js","sourceRoot":"","sources":["../../../src/scripts/removeJob-1.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuOf,CAAC;AACW,QAAA,SAAS,GAAG;IACvB,IAAI,EAAE,WAAW;IACjB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
1
+ {"version":3,"file":"removeJob-1.js","sourceRoot":"","sources":["../../../src/scripts/removeJob-1.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoPf,CAAC;AACW,QAAA,SAAS,GAAG;IACvB,IAAI,EAAE,WAAW;IACjB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}