bullmq 5.52.2 → 5.53.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.
- package/dist/cjs/classes/child-processor.js +17 -0
- package/dist/cjs/classes/child-processor.js.map +1 -1
- package/dist/cjs/classes/flow-producer.js.map +1 -1
- package/dist/cjs/classes/job.js +15 -3
- package/dist/cjs/classes/job.js.map +1 -1
- package/dist/cjs/classes/sandbox.js +10 -0
- package/dist/cjs/classes/sandbox.js.map +1 -1
- package/dist/cjs/classes/scripts.js +33 -16
- package/dist/cjs/classes/scripts.js.map +1 -1
- package/dist/cjs/commands/includes/moveChildFromDependenciesIfNeeded.lua +2 -4
- package/dist/cjs/commands/includes/{moveJobFromPriorityToActive.lua → moveJobFromPrioritizedToActive.lua} +1 -1
- package/dist/cjs/commands/includes/moveParentToWait.lua +0 -3
- package/dist/cjs/commands/moveToActive-11.lua +2 -2
- package/dist/cjs/commands/moveToFinished-14.lua +13 -8
- package/dist/cjs/enums/child-command.js +1 -0
- package/dist/cjs/enums/child-command.js.map +1 -1
- package/dist/cjs/enums/error-code.js +2 -1
- package/dist/cjs/enums/error-code.js.map +1 -1
- package/dist/cjs/enums/parent-command.js +1 -0
- package/dist/cjs/enums/parent-command.js.map +1 -1
- package/dist/cjs/interfaces/index.js +1 -0
- package/dist/cjs/interfaces/index.js.map +1 -1
- package/dist/cjs/interfaces/parent-options.js +3 -0
- package/dist/cjs/interfaces/parent-options.js.map +1 -0
- package/dist/cjs/scripts/addDelayedJob-6.js +0 -2
- package/dist/cjs/scripts/addDelayedJob-6.js.map +1 -1
- package/dist/cjs/scripts/addParentJob-4.js +0 -2
- package/dist/cjs/scripts/addParentJob-4.js.map +1 -1
- package/dist/cjs/scripts/addPrioritizedJob-8.js +0 -2
- package/dist/cjs/scripts/addPrioritizedJob-8.js.map +1 -1
- package/dist/cjs/scripts/addStandardJob-8.js +0 -2
- package/dist/cjs/scripts/addStandardJob-8.js.map +1 -1
- package/dist/cjs/scripts/moveStalledJobsToWait-9.js +2 -6
- package/dist/cjs/scripts/moveStalledJobsToWait-9.js.map +1 -1
- package/dist/cjs/scripts/moveToActive-11.js +2 -2
- package/dist/cjs/scripts/moveToFinished-14.js +14 -14
- package/dist/cjs/scripts/moveToWaitingChildren-8.js +2 -6
- package/dist/cjs/scripts/moveToWaitingChildren-8.js.map +1 -1
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/cjs/utils.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/classes/child-processor.js +17 -0
- package/dist/esm/classes/child-processor.js.map +1 -1
- package/dist/esm/classes/flow-producer.d.ts +3 -9
- package/dist/esm/classes/flow-producer.js.map +1 -1
- package/dist/esm/classes/job.d.ts +3 -3
- package/dist/esm/classes/job.js +15 -3
- package/dist/esm/classes/job.js.map +1 -1
- package/dist/esm/classes/sandbox.js +10 -0
- package/dist/esm/classes/sandbox.js.map +1 -1
- package/dist/esm/classes/scripts.d.ts +6 -2
- package/dist/esm/classes/scripts.js +33 -16
- package/dist/esm/classes/scripts.js.map +1 -1
- package/dist/esm/commands/includes/moveChildFromDependenciesIfNeeded.lua +2 -4
- package/dist/esm/commands/includes/{moveJobFromPriorityToActive.lua → moveJobFromPrioritizedToActive.lua} +1 -1
- package/dist/esm/commands/includes/moveParentToWait.lua +0 -3
- package/dist/esm/commands/moveToActive-11.lua +2 -2
- package/dist/esm/commands/moveToFinished-14.lua +13 -8
- package/dist/esm/enums/child-command.d.ts +2 -1
- package/dist/esm/enums/child-command.js +1 -0
- package/dist/esm/enums/child-command.js.map +1 -1
- package/dist/esm/enums/error-code.d.ts +3 -2
- package/dist/esm/enums/error-code.js +2 -1
- package/dist/esm/enums/error-code.js.map +1 -1
- package/dist/esm/enums/parent-command.d.ts +2 -1
- package/dist/esm/enums/parent-command.js +1 -0
- package/dist/esm/enums/parent-command.js.map +1 -1
- package/dist/esm/interfaces/base-job-options.d.ts +3 -9
- package/dist/esm/interfaces/index.d.ts +1 -0
- package/dist/esm/interfaces/index.js +1 -0
- package/dist/esm/interfaces/index.js.map +1 -1
- package/dist/esm/interfaces/minimal-job.d.ts +2 -4
- package/dist/esm/interfaces/parent-options.d.ts +11 -0
- package/dist/esm/interfaces/parent-options.js +2 -0
- package/dist/esm/interfaces/parent-options.js.map +1 -0
- package/dist/esm/interfaces/parent.d.ts +6 -2
- package/dist/esm/scripts/addDelayedJob-6.js +0 -2
- package/dist/esm/scripts/addDelayedJob-6.js.map +1 -1
- package/dist/esm/scripts/addParentJob-4.js +0 -2
- package/dist/esm/scripts/addParentJob-4.js.map +1 -1
- package/dist/esm/scripts/addPrioritizedJob-8.js +0 -2
- package/dist/esm/scripts/addPrioritizedJob-8.js.map +1 -1
- package/dist/esm/scripts/addStandardJob-8.js +0 -2
- package/dist/esm/scripts/addStandardJob-8.js.map +1 -1
- package/dist/esm/scripts/moveStalledJobsToWait-9.js +2 -6
- package/dist/esm/scripts/moveStalledJobsToWait-9.js.map +1 -1
- package/dist/esm/scripts/moveToActive-11.js +2 -2
- package/dist/esm/scripts/moveToFinished-14.js +14 -14
- package/dist/esm/scripts/moveToWaitingChildren-8.js +2 -6
- package/dist/esm/scripts/moveToWaitingChildren-8.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/utils.d.ts +2 -5
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +1 -1
@@ -19,9 +19,6 @@ local function moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
|
|
19
19
|
local priority = tonumber(jobAttributes[1]) or 0
|
20
20
|
local delay = tonumber(jobAttributes[2]) or 0
|
21
21
|
|
22
|
-
-- ignore dependencies if any left
|
23
|
-
rcall("HSET", parentKey, "igdp", 1)
|
24
|
-
|
25
22
|
if delay > 0 then
|
26
23
|
local delayedTimestamp = tonumber(timestamp) + delay
|
27
24
|
local score = delayedTimestamp * 0x1000
|
@@ -47,7 +47,7 @@ local opts = cmsgpack.unpack(ARGV[3])
|
|
47
47
|
--- @include "includes/getNextDelayedTimestamp"
|
48
48
|
--- @include "includes/getRateLimitTTL"
|
49
49
|
--- @include "includes/getTargetQueueList"
|
50
|
-
--- @include "includes/
|
50
|
+
--- @include "includes/moveJobFromPrioritizedToActive"
|
51
51
|
--- @include "includes/prepareJobForProcessing"
|
52
52
|
--- @include "includes/promoteDelayedJobs"
|
53
53
|
|
@@ -80,7 +80,7 @@ if jobId then
|
|
80
80
|
return prepareJobForProcessing(ARGV[1], rateLimiterKey, eventStreamKey, jobId, ARGV[2],
|
81
81
|
maxJobs, markerKey, opts)
|
82
82
|
else
|
83
|
-
jobId =
|
83
|
+
jobId = moveJobFromPrioritizedToActive(KEYS[3], activeKey, KEYS[10])
|
84
84
|
if jobId then
|
85
85
|
return prepareJobForProcessing(ARGV[1], rateLimiterKey, eventStreamKey, jobId, ARGV[2],
|
86
86
|
maxJobs, markerKey, opts)
|
@@ -50,8 +50,9 @@
|
|
50
50
|
-1 Missing key.
|
51
51
|
-2 Missing lock.
|
52
52
|
-3 Job not in active set
|
53
|
-
-4 Job has pending
|
53
|
+
-4 Job has pending children
|
54
54
|
-6 Lock is not owned by this client
|
55
|
+
-9 Job has failed children
|
55
56
|
|
56
57
|
Events:
|
57
58
|
'completed/failed'
|
@@ -63,7 +64,7 @@ local rcall = redis.call
|
|
63
64
|
--- @include "includes/getNextDelayedTimestamp"
|
64
65
|
--- @include "includes/getRateLimitTTL"
|
65
66
|
--- @include "includes/getTargetQueueList"
|
66
|
-
--- @include "includes/
|
67
|
+
--- @include "includes/moveJobFromPrioritizedToActive"
|
67
68
|
--- @include "includes/moveChildFromDependenciesIfNeeded"
|
68
69
|
--- @include "includes/prepareJobForProcessing"
|
69
70
|
--- @include "includes/promoteDelayedJobs"
|
@@ -81,10 +82,14 @@ local jobIdKey = KEYS[12]
|
|
81
82
|
if rcall("EXISTS", jobIdKey) == 1 then -- Make sure job exists
|
82
83
|
-- Make sure it does not have pending dependencies
|
83
84
|
-- It must happen before removing lock
|
84
|
-
if ARGV[5] == "completed"
|
85
|
-
|
86
|
-
|
87
|
-
|
85
|
+
if ARGV[5] == "completed" then
|
86
|
+
if rcall("SCARD", jobIdKey .. ":dependencies") ~= 0 then
|
87
|
+
return -4
|
88
|
+
end
|
89
|
+
|
90
|
+
if rcall("ZCARD", jobIdKey .. ":unsuccessful") ~= 0 then
|
91
|
+
return -9
|
92
|
+
end
|
88
93
|
end
|
89
94
|
|
90
95
|
local opts = cmsgpack.unpack(ARGV[8])
|
@@ -234,7 +239,7 @@ if rcall("EXISTS", jobIdKey) == 1 then -- Make sure job exists
|
|
234
239
|
-- If jobId is special ID 0:delay (delay greater than 0), then there is no job to process
|
235
240
|
-- but if ID is 0:0, then there is at least 1 prioritized job to process
|
236
241
|
if jobId == "0:0" then
|
237
|
-
jobId =
|
242
|
+
jobId = moveJobFromPrioritizedToActive(KEYS[3], KEYS[2], KEYS[10])
|
238
243
|
return prepareJobForProcessing(prefix, KEYS[6], eventStreamKey, jobId, timestamp, maxJobs,
|
239
244
|
markerKey, opts)
|
240
245
|
end
|
@@ -243,7 +248,7 @@ if rcall("EXISTS", jobIdKey) == 1 then -- Make sure job exists
|
|
243
248
|
opts)
|
244
249
|
end
|
245
250
|
else
|
246
|
-
jobId =
|
251
|
+
jobId = moveJobFromPrioritizedToActive(KEYS[3], KEYS[2], KEYS[10])
|
247
252
|
if jobId then
|
248
253
|
return prepareJobForProcessing(prefix, KEYS[6], eventStreamKey, jobId, timestamp, maxJobs, markerKey,
|
249
254
|
opts)
|
@@ -7,5 +7,6 @@ var ChildCommand;
|
|
7
7
|
ChildCommand[ChildCommand["Start"] = 1] = "Start";
|
8
8
|
ChildCommand[ChildCommand["Stop"] = 2] = "Stop";
|
9
9
|
ChildCommand[ChildCommand["GetChildrenValuesResponse"] = 3] = "GetChildrenValuesResponse";
|
10
|
+
ChildCommand[ChildCommand["GetIgnoredChildrenFailuresResponse"] = 4] = "GetIgnoredChildrenFailuresResponse";
|
10
11
|
})(ChildCommand = exports.ChildCommand || (exports.ChildCommand = {}));
|
11
12
|
//# sourceMappingURL=child-command.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"child-command.js","sourceRoot":"","sources":["../../../src/enums/child-command.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
1
|
+
{"version":3,"file":"child-command.js","sourceRoot":"","sources":["../../../src/enums/child-command.ts"],"names":[],"mappings":";;;AAAA,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,+CAAI,CAAA;IACJ,iDAAK,CAAA;IACL,+CAAI,CAAA;IACJ,yFAAyB,CAAA;IACzB,2GAAkC,CAAA;AACpC,CAAC,EANW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAMvB"}
|
@@ -6,10 +6,11 @@ var ErrorCode;
|
|
6
6
|
ErrorCode[ErrorCode["JobNotExist"] = -1] = "JobNotExist";
|
7
7
|
ErrorCode[ErrorCode["JobLockNotExist"] = -2] = "JobLockNotExist";
|
8
8
|
ErrorCode[ErrorCode["JobNotInState"] = -3] = "JobNotInState";
|
9
|
-
ErrorCode[ErrorCode["
|
9
|
+
ErrorCode[ErrorCode["JobPendingChildren"] = -4] = "JobPendingChildren";
|
10
10
|
ErrorCode[ErrorCode["ParentJobNotExist"] = -5] = "ParentJobNotExist";
|
11
11
|
ErrorCode[ErrorCode["JobLockMismatch"] = -6] = "JobLockMismatch";
|
12
12
|
ErrorCode[ErrorCode["ParentJobCannotBeReplaced"] = -7] = "ParentJobCannotBeReplaced";
|
13
13
|
ErrorCode[ErrorCode["JobBelongsToJobScheduler"] = -8] = "JobBelongsToJobScheduler";
|
14
|
+
ErrorCode[ErrorCode["JobFailedChildren"] = -9] = "JobFailedChildren";
|
14
15
|
})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
|
15
16
|
//# sourceMappingURL=error-code.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"error-code.js","sourceRoot":"","sources":["../../../src/enums/error-code.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
1
|
+
{"version":3,"file":"error-code.js","sourceRoot":"","sources":["../../../src/enums/error-code.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAUX;AAVD,WAAY,SAAS;IACnB,wDAAgB,CAAA;IAChB,gEAAoB,CAAA;IACpB,4DAAkB,CAAA;IAClB,sEAAuB,CAAA;IACvB,oEAAsB,CAAA;IACtB,gEAAoB,CAAA;IACpB,oFAA8B,CAAA;IAC9B,kFAA6B,CAAA;IAC7B,oEAAsB,CAAA;AACxB,CAAC,EAVW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAUpB"}
|
@@ -13,5 +13,6 @@ var ParentCommand;
|
|
13
13
|
ParentCommand[ParentCommand["Progress"] = 7] = "Progress";
|
14
14
|
ParentCommand[ParentCommand["Update"] = 8] = "Update";
|
15
15
|
ParentCommand[ParentCommand["GetChildrenValues"] = 9] = "GetChildrenValues";
|
16
|
+
ParentCommand[ParentCommand["GetIgnoredChildrenFailures"] = 10] = "GetIgnoredChildrenFailures";
|
16
17
|
})(ParentCommand = exports.ParentCommand || (exports.ParentCommand = {}));
|
17
18
|
//# sourceMappingURL=parent-command.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"parent-command.js","sourceRoot":"","sources":["../../../src/enums/parent-command.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
1
|
+
{"version":3,"file":"parent-command.js","sourceRoot":"","sources":["../../../src/enums/parent-command.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAYX;AAZD,WAAY,aAAa;IACvB,2DAAS,CAAA;IACT,mDAAK,CAAA;IACL,qDAAM,CAAA;IACN,6DAAU,CAAA;IACV,mEAAa,CAAA;IACb,+CAAG,CAAA;IACH,mEAAa,CAAA;IACb,yDAAQ,CAAA;IACR,qDAAM,CAAA;IACN,2EAAiB,CAAA;IACjB,8FAA0B,CAAA;AAC5B,CAAC,EAZW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAYxB"}
|
@@ -17,6 +17,7 @@ tslib_1.__exportStar(require("./metrics"), exports);
|
|
17
17
|
tslib_1.__exportStar(require("./minimal-job"), exports);
|
18
18
|
tslib_1.__exportStar(require("./parent-message"), exports);
|
19
19
|
tslib_1.__exportStar(require("./parent"), exports);
|
20
|
+
tslib_1.__exportStar(require("./parent-options"), exports);
|
20
21
|
tslib_1.__exportStar(require("./queue-options"), exports);
|
21
22
|
tslib_1.__exportStar(require("./rate-limiter-options"), exports);
|
22
23
|
tslib_1.__exportStar(require("./redis-options"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,4DAAkC;AAClC,6DAAmC;AACnC,0DAAgC;AAChC,uDAA6B;AAC7B,6DAAmC;AACnC,qDAA2B;AAC3B,2DAAiC;AACjC,qDAA2B;AAC3B,+DAAqC;AACrC,sDAA4B;AAC5B,4DAAkC;AAClC,oDAA0B;AAC1B,wDAA8B;AAC9B,2DAAiC;AACjC,mDAAyB;AACzB,0DAAgC;AAChC,iEAAuC;AACvC,0DAAgC;AAChC,0DAAgC;AAChC,2DAAiC;AACjC,+DAAqC;AACrC,2DAAiC;AACjC,oEAA0C;AAC1C,0DAAgC;AAChC,8DAAoC;AACpC,2DAAiC;AACjC,sDAA4B;AAC5B,qDAA2B"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,4DAAkC;AAClC,6DAAmC;AACnC,0DAAgC;AAChC,uDAA6B;AAC7B,6DAAmC;AACnC,qDAA2B;AAC3B,2DAAiC;AACjC,qDAA2B;AAC3B,+DAAqC;AACrC,sDAA4B;AAC5B,4DAAkC;AAClC,oDAA0B;AAC1B,wDAA8B;AAC9B,2DAAiC;AACjC,mDAAyB;AACzB,2DAAiC;AACjC,0DAAgC;AAChC,iEAAuC;AACvC,0DAAgC;AAChC,0DAAgC;AAChC,2DAAiC;AACjC,+DAAqC;AACrC,2DAAiC;AACjC,oEAA0C;AAC1C,0DAAgC;AAChC,8DAAoC;AACpC,2DAAiC;AACjC,sDAA4B;AAC5B,qDAA2B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parent-options.js","sourceRoot":"","sources":["../../../src/interfaces/parent-options.ts"],"names":[],"mappings":""}
|
@@ -252,8 +252,6 @@ local function moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
|
|
252
252
|
local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
|
253
253
|
local priority = tonumber(jobAttributes[1]) or 0
|
254
254
|
local delay = tonumber(jobAttributes[2]) or 0
|
255
|
-
-- ignore dependencies if any left
|
256
|
-
rcall("HSET", parentKey, "igdp", 1)
|
257
255
|
if delay > 0 then
|
258
256
|
local delayedTimestamp = tonumber(timestamp) + delay
|
259
257
|
local score = delayedTimestamp * 0x1000
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"addDelayedJob-6.js","sourceRoot":"","sources":["../../../src/scripts/addDelayedJob-6.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"addDelayedJob-6.js","sourceRoot":"","sources":["../../../src/scripts/addDelayedJob-6.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyYf,CAAC;AACW,QAAA,aAAa,GAAG;IAC3B,IAAI,EAAE,eAAe;IACrB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -208,8 +208,6 @@ local function moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
|
|
208
208
|
local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
|
209
209
|
local priority = tonumber(jobAttributes[1]) or 0
|
210
210
|
local delay = tonumber(jobAttributes[2]) or 0
|
211
|
-
-- ignore dependencies if any left
|
212
|
-
rcall("HSET", parentKey, "igdp", 1)
|
213
211
|
if delay > 0 then
|
214
212
|
local delayedTimestamp = tonumber(timestamp) + delay
|
215
213
|
local score = delayedTimestamp * 0x1000
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"addParentJob-4.js","sourceRoot":"","sources":["../../../src/scripts/addParentJob-4.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"addParentJob-4.js","sourceRoot":"","sources":["../../../src/scripts/addParentJob-4.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgWf,CAAC;AACW,QAAA,YAAY,GAAG;IAC1B,IAAI,EAAE,cAAc;IACpB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -245,8 +245,6 @@ local function moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
|
|
245
245
|
local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
|
246
246
|
local priority = tonumber(jobAttributes[1]) or 0
|
247
247
|
local delay = tonumber(jobAttributes[2]) or 0
|
248
|
-
-- ignore dependencies if any left
|
249
|
-
rcall("HSET", parentKey, "igdp", 1)
|
250
248
|
if delay > 0 then
|
251
249
|
local delayedTimestamp = tonumber(timestamp) + delay
|
252
250
|
local score = delayedTimestamp * 0x1000
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"addPrioritizedJob-8.js","sourceRoot":"","sources":["../../../src/scripts/addPrioritizedJob-8.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"addPrioritizedJob-8.js","sourceRoot":"","sources":["../../../src/scripts/addPrioritizedJob-8.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Wf,CAAC;AACW,QAAA,iBAAiB,GAAG;IAC/B,IAAI,EAAE,mBAAmB;IACzB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -218,8 +218,6 @@ local function moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
|
|
218
218
|
local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
|
219
219
|
local priority = tonumber(jobAttributes[1]) or 0
|
220
220
|
local delay = tonumber(jobAttributes[2]) or 0
|
221
|
-
-- ignore dependencies if any left
|
222
|
-
rcall("HSET", parentKey, "igdp", 1)
|
223
221
|
if delay > 0 then
|
224
222
|
local delayedTimestamp = tonumber(timestamp) + delay
|
225
223
|
local score = delayedTimestamp * 0x1000
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"addStandardJob-8.js","sourceRoot":"","sources":["../../../src/scripts/addStandardJob-8.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"addStandardJob-8.js","sourceRoot":"","sources":["../../../src/scripts/addStandardJob-8.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Wf,CAAC;AACW,QAAA,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -157,8 +157,6 @@ local function moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
|
|
157
157
|
local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
|
158
158
|
local priority = tonumber(jobAttributes[1]) or 0
|
159
159
|
local delay = tonumber(jobAttributes[2]) or 0
|
160
|
-
-- ignore dependencies if any left
|
161
|
-
rcall("HSET", parentKey, "igdp", 1)
|
162
160
|
if delay > 0 then
|
163
161
|
local delayedTimestamp = tonumber(timestamp) + delay
|
164
162
|
local score = delayedTimestamp * 0x1000
|
@@ -372,9 +370,7 @@ local function removeJobsOnFail(queueKeyPrefix, failedKey, jobId, opts, timestam
|
|
372
370
|
end
|
373
371
|
end
|
374
372
|
end
|
375
|
-
local moveParentToFailedIfNeeded
|
376
|
-
local moveChildFromDependenciesIfNeeded
|
377
|
-
moveParentToFailedIfNeeded = function (parentQueueKey, parentKey, parentId, jobIdKey, timestamp)
|
373
|
+
local moveParentToFailedIfNeeded = function (parentQueueKey, parentKey, parentId, jobIdKey, timestamp)
|
378
374
|
if rcall("EXISTS", parentKey) == 1 then
|
379
375
|
local parentWaitingChildrenKey = parentQueueKey .. ":waiting-children"
|
380
376
|
local parentDelayedKey = parentQueueKey .. ":delayed"
|
@@ -404,7 +400,7 @@ moveParentToFailedIfNeeded = function (parentQueueKey, parentKey, parentId, jobI
|
|
404
400
|
end
|
405
401
|
end
|
406
402
|
end
|
407
|
-
moveChildFromDependenciesIfNeeded = function (rawParentData, childKey, failedReason, timestamp)
|
403
|
+
local moveChildFromDependenciesIfNeeded = function (rawParentData, childKey, failedReason, timestamp)
|
408
404
|
if rawParentData then
|
409
405
|
local parentData = cjson.decode(rawParentData)
|
410
406
|
local parentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyiBf,CAAC;AACW,QAAA,qBAAqB,GAAG;IACnC,IAAI,EAAE,uBAAuB;IAC7B,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -89,7 +89,7 @@ end
|
|
89
89
|
--[[
|
90
90
|
Function to move job from prioritized state to active.
|
91
91
|
]]
|
92
|
-
local function
|
92
|
+
local function moveJobFromPrioritizedToActive(priorityKey, activeKey, priorityCounterKey)
|
93
93
|
local prioritizedJob = rcall("ZPOPMIN", priorityKey)
|
94
94
|
if #prioritizedJob > 0 then
|
95
95
|
rcall("LPUSH", activeKey, prioritizedJob[1])
|
@@ -222,7 +222,7 @@ if jobId then
|
|
222
222
|
return prepareJobForProcessing(ARGV[1], rateLimiterKey, eventStreamKey, jobId, ARGV[2],
|
223
223
|
maxJobs, markerKey, opts)
|
224
224
|
else
|
225
|
-
jobId =
|
225
|
+
jobId = moveJobFromPrioritizedToActive(KEYS[3], activeKey, KEYS[10])
|
226
226
|
if jobId then
|
227
227
|
return prepareJobForProcessing(ARGV[1], rateLimiterKey, eventStreamKey, jobId, ARGV[2],
|
228
228
|
maxJobs, markerKey, opts)
|
@@ -46,8 +46,9 @@ const content = `--[[
|
|
46
46
|
-1 Missing key.
|
47
47
|
-2 Missing lock.
|
48
48
|
-3 Job not in active set
|
49
|
-
-4 Job has pending
|
49
|
+
-4 Job has pending children
|
50
50
|
-6 Lock is not owned by this client
|
51
|
+
-9 Job has failed children
|
51
52
|
Events:
|
52
53
|
'completed/failed'
|
53
54
|
]]
|
@@ -157,7 +158,7 @@ end
|
|
157
158
|
--[[
|
158
159
|
Function to move job from prioritized state to active.
|
159
160
|
]]
|
160
|
-
local function
|
161
|
+
local function moveJobFromPrioritizedToActive(priorityKey, activeKey, priorityCounterKey)
|
161
162
|
local prioritizedJob = rcall("ZPOPMIN", priorityKey)
|
162
163
|
if #prioritizedJob > 0 then
|
163
164
|
rcall("LPUSH", activeKey, prioritizedJob[1])
|
@@ -253,8 +254,6 @@ local function moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
|
|
253
254
|
local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
|
254
255
|
local priority = tonumber(jobAttributes[1]) or 0
|
255
256
|
local delay = tonumber(jobAttributes[2]) or 0
|
256
|
-
-- ignore dependencies if any left
|
257
|
-
rcall("HSET", parentKey, "igdp", 1)
|
258
257
|
if delay > 0 then
|
259
258
|
local delayedTimestamp = tonumber(timestamp) + delay
|
260
259
|
local score = delayedTimestamp * 0x1000
|
@@ -468,9 +467,7 @@ local function removeJobsOnFail(queueKeyPrefix, failedKey, jobId, opts, timestam
|
|
468
467
|
end
|
469
468
|
end
|
470
469
|
end
|
471
|
-
local moveParentToFailedIfNeeded
|
472
|
-
local moveChildFromDependenciesIfNeeded
|
473
|
-
moveParentToFailedIfNeeded = function (parentQueueKey, parentKey, parentId, jobIdKey, timestamp)
|
470
|
+
local moveParentToFailedIfNeeded = function (parentQueueKey, parentKey, parentId, jobIdKey, timestamp)
|
474
471
|
if rcall("EXISTS", parentKey) == 1 then
|
475
472
|
local parentWaitingChildrenKey = parentQueueKey .. ":waiting-children"
|
476
473
|
local parentDelayedKey = parentQueueKey .. ":delayed"
|
@@ -500,7 +497,7 @@ moveParentToFailedIfNeeded = function (parentQueueKey, parentKey, parentId, jobI
|
|
500
497
|
end
|
501
498
|
end
|
502
499
|
end
|
503
|
-
moveChildFromDependenciesIfNeeded = function (rawParentData, childKey, failedReason, timestamp)
|
500
|
+
local moveChildFromDependenciesIfNeeded = function (rawParentData, childKey, failedReason, timestamp)
|
504
501
|
if rawParentData then
|
505
502
|
local parentData = cjson.decode(rawParentData)
|
506
503
|
local parentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
@@ -691,10 +688,13 @@ local jobIdKey = KEYS[12]
|
|
691
688
|
if rcall("EXISTS", jobIdKey) == 1 then -- Make sure job exists
|
692
689
|
-- Make sure it does not have pending dependencies
|
693
690
|
-- It must happen before removing lock
|
694
|
-
if ARGV[5] == "completed"
|
695
|
-
|
696
|
-
|
697
|
-
|
691
|
+
if ARGV[5] == "completed" then
|
692
|
+
if rcall("SCARD", jobIdKey .. ":dependencies") ~= 0 then
|
693
|
+
return -4
|
694
|
+
end
|
695
|
+
if rcall("ZCARD", jobIdKey .. ":unsuccessful") ~= 0 then
|
696
|
+
return -9
|
697
|
+
end
|
698
698
|
end
|
699
699
|
local opts = cmsgpack.unpack(ARGV[8])
|
700
700
|
local token = opts['token']
|
@@ -813,7 +813,7 @@ if rcall("EXISTS", jobIdKey) == 1 then -- Make sure job exists
|
|
813
813
|
-- If jobId is special ID 0:delay (delay greater than 0), then there is no job to process
|
814
814
|
-- but if ID is 0:0, then there is at least 1 prioritized job to process
|
815
815
|
if jobId == "0:0" then
|
816
|
-
jobId =
|
816
|
+
jobId = moveJobFromPrioritizedToActive(KEYS[3], KEYS[2], KEYS[10])
|
817
817
|
return prepareJobForProcessing(prefix, KEYS[6], eventStreamKey, jobId, timestamp, maxJobs,
|
818
818
|
markerKey, opts)
|
819
819
|
end
|
@@ -822,7 +822,7 @@ if rcall("EXISTS", jobIdKey) == 1 then -- Make sure job exists
|
|
822
822
|
opts)
|
823
823
|
end
|
824
824
|
else
|
825
|
-
jobId =
|
825
|
+
jobId = moveJobFromPrioritizedToActive(KEYS[3], KEYS[2], KEYS[10])
|
826
826
|
if jobId then
|
827
827
|
return prepareJobForProcessing(prefix, KEYS[6], eventStreamKey, jobId, timestamp, maxJobs, markerKey,
|
828
828
|
opts)
|
@@ -154,8 +154,6 @@ local function moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
|
|
154
154
|
local jobAttributes = rcall("HMGET", parentKey, "priority", "delay")
|
155
155
|
local priority = tonumber(jobAttributes[1]) or 0
|
156
156
|
local delay = tonumber(jobAttributes[2]) or 0
|
157
|
-
-- ignore dependencies if any left
|
158
|
-
rcall("HSET", parentKey, "igdp", 1)
|
159
157
|
if delay > 0 then
|
160
158
|
local delayedTimestamp = tonumber(timestamp) + delay
|
161
159
|
local score = delayedTimestamp * 0x1000
|
@@ -369,9 +367,7 @@ local function removeJobsOnFail(queueKeyPrefix, failedKey, jobId, opts, timestam
|
|
369
367
|
end
|
370
368
|
end
|
371
369
|
end
|
372
|
-
local moveParentToFailedIfNeeded
|
373
|
-
local moveChildFromDependenciesIfNeeded
|
374
|
-
moveParentToFailedIfNeeded = function (parentQueueKey, parentKey, parentId, jobIdKey, timestamp)
|
370
|
+
local moveParentToFailedIfNeeded = function (parentQueueKey, parentKey, parentId, jobIdKey, timestamp)
|
375
371
|
if rcall("EXISTS", parentKey) == 1 then
|
376
372
|
local parentWaitingChildrenKey = parentQueueKey .. ":waiting-children"
|
377
373
|
local parentDelayedKey = parentQueueKey .. ":delayed"
|
@@ -401,7 +397,7 @@ moveParentToFailedIfNeeded = function (parentQueueKey, parentKey, parentId, jobI
|
|
401
397
|
end
|
402
398
|
end
|
403
399
|
end
|
404
|
-
moveChildFromDependenciesIfNeeded = function (rawParentData, childKey, failedReason, timestamp)
|
400
|
+
local moveChildFromDependenciesIfNeeded = function (rawParentData, childKey, failedReason, timestamp)
|
405
401
|
if rawParentData then
|
406
402
|
local parentData = cjson.decode(rawParentData)
|
407
403
|
local parentKey = parentData['queueKey'] .. ':' .. parentData['id']
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAugBf,CAAC;AACW,QAAA,qBAAqB,GAAG;IACnC,IAAI,EAAE,uBAAuB;IAC7B,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|