bullmq 5.44.0 → 5.44.1
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/moveParentFromWaitingChildrenToFailed.lua +17 -45
- package/dist/cjs/scripts/moveStalledJobsToWait-9.js +16 -40
- package/dist/cjs/scripts/moveStalledJobsToWait-9.js.map +1 -1
- package/dist/cjs/scripts/moveToFinished-14.js +16 -40
- package/dist/cjs/scripts/moveToFinished-14.js.map +1 -1
- package/dist/cjs/scripts/moveToWaitingChildren-8.js +16 -40
- 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/moveParentFromWaitingChildrenToFailed.lua +17 -45
- package/dist/esm/scripts/moveStalledJobsToWait-9.js +16 -40
- package/dist/esm/scripts/moveStalledJobsToWait-9.js.map +1 -1
- package/dist/esm/scripts/moveToFinished-14.js +16 -40
- package/dist/esm/scripts/moveToFinished-14.js.map +1 -1
- package/dist/esm/scripts/moveToWaitingChildren-8.js +16 -40
- 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
@@ -10,15 +10,29 @@
|
|
10
10
|
local function moveParentFromWaitingChildrenToFailed(parentQueueKey, parentKey, parentId, jobIdKey, timestamp)
|
11
11
|
local parentWaitingChildrenKey = parentQueueKey .. ":waiting-children"
|
12
12
|
local parentDelayedKey = parentQueueKey .. ":delayed"
|
13
|
-
|
14
|
-
|
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)
|
15
29
|
local parentQueuePrefix = parentQueueKey .. ":"
|
16
30
|
local parentFailedKey = parentQueueKey .. ":failed"
|
17
31
|
rcall("ZADD", parentFailedKey, timestamp, parentId)
|
18
32
|
local failedReason = "child " .. jobIdKey .. " failed"
|
19
33
|
rcall("HSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
|
20
34
|
rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
|
21
|
-
failedReason, "prev",
|
35
|
+
failedReason, "prev", prevState)
|
22
36
|
|
23
37
|
local jobAttributes = rcall("HMGET", parentKey, "parent", "deid", "opts")
|
24
38
|
|
@@ -54,48 +68,6 @@ local function moveParentFromWaitingChildrenToFailed(parentQueueKey, parentKey,
|
|
54
68
|
local parentRawOpts = jobAttributes[3]
|
55
69
|
local parentOpts = cjson.decode(parentRawOpts)
|
56
70
|
|
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
71
|
removeJobsOnFail(parentQueuePrefix, parentFailedKey, parentId, parentOpts, timestamp)
|
100
72
|
else
|
101
73
|
local grandParentKey = rcall("HGET", parentKey, "parentKey")
|
@@ -364,15 +364,28 @@ end
|
|
364
364
|
local function moveParentFromWaitingChildrenToFailed(parentQueueKey, parentKey, parentId, jobIdKey, timestamp)
|
365
365
|
local parentWaitingChildrenKey = parentQueueKey .. ":waiting-children"
|
366
366
|
local parentDelayedKey = parentQueueKey .. ":delayed"
|
367
|
-
|
368
|
-
|
367
|
+
local parentPrioritizedKey = parentQueueKey .. ":prioritized"
|
368
|
+
local parentWaitingChildrenOrDelayedOrPrioritizedKey
|
369
|
+
local prevState
|
370
|
+
if rcall("ZSCORE", parentWaitingChildrenKey, parentId) then
|
371
|
+
parentWaitingChildrenOrDelayedOrPrioritizedKey = parentWaitingChildrenKey
|
372
|
+
prevState = "waiting-children"
|
373
|
+
elseif rcall("ZSCORE", parentDelayedKey, parentId) then
|
374
|
+
parentWaitingChildrenOrDelayedOrPrioritizedKey = parentDelayedKey
|
375
|
+
prevState = "delayed"
|
376
|
+
elseif rcall("ZSCORE", parentPrioritizedKey, parentId) then
|
377
|
+
parentWaitingChildrenOrDelayedOrPrioritizedKey = parentPrioritizedKey
|
378
|
+
prevState = "prioritized"
|
379
|
+
end
|
380
|
+
if parentWaitingChildrenOrDelayedOrPrioritizedKey then
|
381
|
+
rcall("ZREM", parentWaitingChildrenOrDelayedOrPrioritizedKey, parentId)
|
369
382
|
local parentQueuePrefix = parentQueueKey .. ":"
|
370
383
|
local parentFailedKey = parentQueueKey .. ":failed"
|
371
384
|
rcall("ZADD", parentFailedKey, timestamp, parentId)
|
372
385
|
local failedReason = "child " .. jobIdKey .. " failed"
|
373
386
|
rcall("HSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
|
374
387
|
rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
|
375
|
-
failedReason, "prev",
|
388
|
+
failedReason, "prev", prevState)
|
376
389
|
local jobAttributes = rcall("HMGET", parentKey, "parent", "deid", "opts")
|
377
390
|
removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2])
|
378
391
|
if jobAttributes[1] then
|
@@ -404,43 +417,6 @@ local function moveParentFromWaitingChildrenToFailed(parentQueueKey, parentKey,
|
|
404
417
|
local parentRawOpts = jobAttributes[3]
|
405
418
|
local parentOpts = cjson.decode(parentRawOpts)
|
406
419
|
removeJobsOnFail(parentQueuePrefix, parentFailedKey, parentId, parentOpts, timestamp)
|
407
|
-
elseif rcall("ZSCORE", parentDelayedKey, parentId) ~= false then
|
408
|
-
rcall("ZREM", parentDelayedKey, parentId)
|
409
|
-
local parentQueuePrefix = parentQueueKey .. ":"
|
410
|
-
local parentFailedKey = parentQueueKey .. ":failed"
|
411
|
-
rcall("ZADD", parentFailedKey, timestamp, parentId)
|
412
|
-
local failedReason = "child " .. jobIdKey .. " failed"
|
413
|
-
rcall("HMSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
|
414
|
-
rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
|
415
|
-
failedReason, "prev", "delayed")
|
416
|
-
local jobAttributes = rcall("HMGET", parentKey, "parent", "deid", "opts")
|
417
|
-
removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2])
|
418
|
-
if jobAttributes[1] then
|
419
|
-
local parentData = cjson.decode(jobAttributes[1])
|
420
|
-
if parentData['fpof'] then
|
421
|
-
moveParentFromWaitingChildrenToFailed(
|
422
|
-
parentData['queueKey'],
|
423
|
-
parentData['queueKey'] .. ':' .. parentData['id'],
|
424
|
-
parentData['id'],
|
425
|
-
parentKey,
|
426
|
-
timestamp
|
427
|
-
)
|
428
|
-
elseif parentData['idof'] or parentData['rdof'] then
|
429
|
-
local grandParentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
430
|
-
local grandParentDependenciesSet = grandParentKey .. ":dependencies"
|
431
|
-
if rcall("SREM", grandParentDependenciesSet, parentKey) == 1 then
|
432
|
-
moveParentToWaitIfNeeded(parentData['queueKey'], grandParentDependenciesSet,
|
433
|
-
grandParentKey, parentData['id'], timestamp)
|
434
|
-
if parentData['idof'] then
|
435
|
-
local grandParentFailedSet = grandParentKey .. ":failed"
|
436
|
-
rcall("HSET", grandParentFailedSet, parentKey, failedReason)
|
437
|
-
end
|
438
|
-
end
|
439
|
-
end
|
440
|
-
end
|
441
|
-
local parentRawOpts = jobAttributes[3]
|
442
|
-
local parentOpts = cjson.decode(parentRawOpts)
|
443
|
-
removeJobsOnFail(parentQueuePrefix, parentFailedKey, parentId, parentOpts, timestamp)
|
444
420
|
else
|
445
421
|
local grandParentKey = rcall("HGET", parentKey, "parentKey")
|
446
422
|
if grandParentKey then
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBA2iBS,CAAC;AACb,QAAA,qBAAqB,GAAG;IACnC,IAAI,EAAE,uBAAuB;IAC7B,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -459,15 +459,28 @@ end
|
|
459
459
|
local function moveParentFromWaitingChildrenToFailed(parentQueueKey, parentKey, parentId, jobIdKey, timestamp)
|
460
460
|
local parentWaitingChildrenKey = parentQueueKey .. ":waiting-children"
|
461
461
|
local parentDelayedKey = parentQueueKey .. ":delayed"
|
462
|
-
|
463
|
-
|
462
|
+
local parentPrioritizedKey = parentQueueKey .. ":prioritized"
|
463
|
+
local parentWaitingChildrenOrDelayedOrPrioritizedKey
|
464
|
+
local prevState
|
465
|
+
if rcall("ZSCORE", parentWaitingChildrenKey, parentId) then
|
466
|
+
parentWaitingChildrenOrDelayedOrPrioritizedKey = parentWaitingChildrenKey
|
467
|
+
prevState = "waiting-children"
|
468
|
+
elseif rcall("ZSCORE", parentDelayedKey, parentId) then
|
469
|
+
parentWaitingChildrenOrDelayedOrPrioritizedKey = parentDelayedKey
|
470
|
+
prevState = "delayed"
|
471
|
+
elseif rcall("ZSCORE", parentPrioritizedKey, parentId) then
|
472
|
+
parentWaitingChildrenOrDelayedOrPrioritizedKey = parentPrioritizedKey
|
473
|
+
prevState = "prioritized"
|
474
|
+
end
|
475
|
+
if parentWaitingChildrenOrDelayedOrPrioritizedKey then
|
476
|
+
rcall("ZREM", parentWaitingChildrenOrDelayedOrPrioritizedKey, parentId)
|
464
477
|
local parentQueuePrefix = parentQueueKey .. ":"
|
465
478
|
local parentFailedKey = parentQueueKey .. ":failed"
|
466
479
|
rcall("ZADD", parentFailedKey, timestamp, parentId)
|
467
480
|
local failedReason = "child " .. jobIdKey .. " failed"
|
468
481
|
rcall("HSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
|
469
482
|
rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
|
470
|
-
failedReason, "prev",
|
483
|
+
failedReason, "prev", prevState)
|
471
484
|
local jobAttributes = rcall("HMGET", parentKey, "parent", "deid", "opts")
|
472
485
|
removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2])
|
473
486
|
if jobAttributes[1] then
|
@@ -499,43 +512,6 @@ local function moveParentFromWaitingChildrenToFailed(parentQueueKey, parentKey,
|
|
499
512
|
local parentRawOpts = jobAttributes[3]
|
500
513
|
local parentOpts = cjson.decode(parentRawOpts)
|
501
514
|
removeJobsOnFail(parentQueuePrefix, parentFailedKey, parentId, parentOpts, timestamp)
|
502
|
-
elseif rcall("ZSCORE", parentDelayedKey, parentId) ~= false then
|
503
|
-
rcall("ZREM", parentDelayedKey, parentId)
|
504
|
-
local parentQueuePrefix = parentQueueKey .. ":"
|
505
|
-
local parentFailedKey = parentQueueKey .. ":failed"
|
506
|
-
rcall("ZADD", parentFailedKey, timestamp, parentId)
|
507
|
-
local failedReason = "child " .. jobIdKey .. " failed"
|
508
|
-
rcall("HMSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
|
509
|
-
rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
|
510
|
-
failedReason, "prev", "delayed")
|
511
|
-
local jobAttributes = rcall("HMGET", parentKey, "parent", "deid", "opts")
|
512
|
-
removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2])
|
513
|
-
if jobAttributes[1] then
|
514
|
-
local parentData = cjson.decode(jobAttributes[1])
|
515
|
-
if parentData['fpof'] then
|
516
|
-
moveParentFromWaitingChildrenToFailed(
|
517
|
-
parentData['queueKey'],
|
518
|
-
parentData['queueKey'] .. ':' .. parentData['id'],
|
519
|
-
parentData['id'],
|
520
|
-
parentKey,
|
521
|
-
timestamp
|
522
|
-
)
|
523
|
-
elseif parentData['idof'] or parentData['rdof'] then
|
524
|
-
local grandParentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
525
|
-
local grandParentDependenciesSet = grandParentKey .. ":dependencies"
|
526
|
-
if rcall("SREM", grandParentDependenciesSet, parentKey) == 1 then
|
527
|
-
moveParentToWaitIfNeeded(parentData['queueKey'], grandParentDependenciesSet,
|
528
|
-
grandParentKey, parentData['id'], timestamp)
|
529
|
-
if parentData['idof'] then
|
530
|
-
local grandParentFailedSet = grandParentKey .. ":failed"
|
531
|
-
rcall("HSET", grandParentFailedSet, parentKey, failedReason)
|
532
|
-
end
|
533
|
-
end
|
534
|
-
end
|
535
|
-
end
|
536
|
-
local parentRawOpts = jobAttributes[3]
|
537
|
-
local parentOpts = cjson.decode(parentRawOpts)
|
538
|
-
removeJobsOnFail(parentQueuePrefix, parentFailedKey, parentId, parentOpts, timestamp)
|
539
515
|
else
|
540
516
|
local grandParentKey = rcall("HGET", parentKey, "parentKey")
|
541
517
|
if grandParentKey then
|
@@ -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/scripts/moveToFinished-14.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuzBf,CAAC;AACW,QAAA,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,EAAE;CACT,CAAC"}
|
@@ -361,15 +361,28 @@ end
|
|
361
361
|
local function moveParentFromWaitingChildrenToFailed(parentQueueKey, parentKey, parentId, jobIdKey, timestamp)
|
362
362
|
local parentWaitingChildrenKey = parentQueueKey .. ":waiting-children"
|
363
363
|
local parentDelayedKey = parentQueueKey .. ":delayed"
|
364
|
-
|
365
|
-
|
364
|
+
local parentPrioritizedKey = parentQueueKey .. ":prioritized"
|
365
|
+
local parentWaitingChildrenOrDelayedOrPrioritizedKey
|
366
|
+
local prevState
|
367
|
+
if rcall("ZSCORE", parentWaitingChildrenKey, parentId) then
|
368
|
+
parentWaitingChildrenOrDelayedOrPrioritizedKey = parentWaitingChildrenKey
|
369
|
+
prevState = "waiting-children"
|
370
|
+
elseif rcall("ZSCORE", parentDelayedKey, parentId) then
|
371
|
+
parentWaitingChildrenOrDelayedOrPrioritizedKey = parentDelayedKey
|
372
|
+
prevState = "delayed"
|
373
|
+
elseif rcall("ZSCORE", parentPrioritizedKey, parentId) then
|
374
|
+
parentWaitingChildrenOrDelayedOrPrioritizedKey = parentPrioritizedKey
|
375
|
+
prevState = "prioritized"
|
376
|
+
end
|
377
|
+
if parentWaitingChildrenOrDelayedOrPrioritizedKey then
|
378
|
+
rcall("ZREM", parentWaitingChildrenOrDelayedOrPrioritizedKey, parentId)
|
366
379
|
local parentQueuePrefix = parentQueueKey .. ":"
|
367
380
|
local parentFailedKey = parentQueueKey .. ":failed"
|
368
381
|
rcall("ZADD", parentFailedKey, timestamp, parentId)
|
369
382
|
local failedReason = "child " .. jobIdKey .. " failed"
|
370
383
|
rcall("HSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
|
371
384
|
rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
|
372
|
-
failedReason, "prev",
|
385
|
+
failedReason, "prev", prevState)
|
373
386
|
local jobAttributes = rcall("HMGET", parentKey, "parent", "deid", "opts")
|
374
387
|
removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2])
|
375
388
|
if jobAttributes[1] then
|
@@ -401,43 +414,6 @@ local function moveParentFromWaitingChildrenToFailed(parentQueueKey, parentKey,
|
|
401
414
|
local parentRawOpts = jobAttributes[3]
|
402
415
|
local parentOpts = cjson.decode(parentRawOpts)
|
403
416
|
removeJobsOnFail(parentQueuePrefix, parentFailedKey, parentId, parentOpts, timestamp)
|
404
|
-
elseif rcall("ZSCORE", parentDelayedKey, parentId) ~= false then
|
405
|
-
rcall("ZREM", parentDelayedKey, parentId)
|
406
|
-
local parentQueuePrefix = parentQueueKey .. ":"
|
407
|
-
local parentFailedKey = parentQueueKey .. ":failed"
|
408
|
-
rcall("ZADD", parentFailedKey, timestamp, parentId)
|
409
|
-
local failedReason = "child " .. jobIdKey .. " failed"
|
410
|
-
rcall("HMSET", parentKey, "failedReason", failedReason, "finishedOn", timestamp)
|
411
|
-
rcall("XADD", parentQueueKey .. ":events", "*", "event", "failed", "jobId", parentId, "failedReason",
|
412
|
-
failedReason, "prev", "delayed")
|
413
|
-
local jobAttributes = rcall("HMGET", parentKey, "parent", "deid", "opts")
|
414
|
-
removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2])
|
415
|
-
if jobAttributes[1] then
|
416
|
-
local parentData = cjson.decode(jobAttributes[1])
|
417
|
-
if parentData['fpof'] then
|
418
|
-
moveParentFromWaitingChildrenToFailed(
|
419
|
-
parentData['queueKey'],
|
420
|
-
parentData['queueKey'] .. ':' .. parentData['id'],
|
421
|
-
parentData['id'],
|
422
|
-
parentKey,
|
423
|
-
timestamp
|
424
|
-
)
|
425
|
-
elseif parentData['idof'] or parentData['rdof'] then
|
426
|
-
local grandParentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
427
|
-
local grandParentDependenciesSet = grandParentKey .. ":dependencies"
|
428
|
-
if rcall("SREM", grandParentDependenciesSet, parentKey) == 1 then
|
429
|
-
moveParentToWaitIfNeeded(parentData['queueKey'], grandParentDependenciesSet,
|
430
|
-
grandParentKey, parentData['id'], timestamp)
|
431
|
-
if parentData['idof'] then
|
432
|
-
local grandParentFailedSet = grandParentKey .. ":failed"
|
433
|
-
rcall("HSET", grandParentFailedSet, parentKey, failedReason)
|
434
|
-
end
|
435
|
-
end
|
436
|
-
end
|
437
|
-
end
|
438
|
-
local parentRawOpts = jobAttributes[3]
|
439
|
-
local parentOpts = cjson.decode(parentRawOpts)
|
440
|
-
removeJobsOnFail(parentQueuePrefix, parentFailedKey, parentId, parentOpts, timestamp)
|
441
417
|
else
|
442
418
|
local grandParentKey = rcall("HGET", parentKey, "parentKey")
|
443
419
|
if grandParentKey then
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"moveToWaitingChildren-8.js","sourceRoot":"","sources":["../../../src/scripts/moveToWaitingChildren-8.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"moveToWaitingChildren-8.js","sourceRoot":"","sources":["../../../src/scripts/moveToWaitingChildren-8.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmgBf,CAAC;AACW,QAAA,qBAAqB,GAAG;IACnC,IAAI,EAAE,uBAAuB;IAC7B,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|