bullmq 1.91.0 → 1.91.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.
@@ -72,20 +72,16 @@ local function moveJobFromWaitToActive(keys, keyPrefix, jobId, processedOn, opts
|
|
72
72
|
|
73
73
|
local jobKey = keyPrefix .. jobId
|
74
74
|
local lockKey = jobKey .. ':lock'
|
75
|
-
|
75
|
+
|
76
76
|
-- get a lock
|
77
77
|
if opts['token'] ~= "0" then
|
78
78
|
rcall("SET", lockKey, opts['token'], "PX", opts['lockDuration'])
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
81
|
rcall("ZREM", keys[3], jobId) -- remove from priority
|
82
82
|
rcall("XADD", keys[4], "*", "event", "active", "jobId", jobId, "prev", "waiting")
|
83
83
|
rcall("HSET", jobKey, "processedOn", processedOn)
|
84
84
|
rcall("HINCRBY", jobKey, "attemptsMade", 1)
|
85
|
-
local len = rcall("LLEN", keys[1])
|
86
|
-
if len == 0 then
|
87
|
-
rcall("XADD", keys[4], "*", "event", "drained");
|
88
|
-
end
|
89
85
|
|
90
86
|
return {rcall("HGETALL", jobKey), jobId} -- get job data
|
91
87
|
end
|
@@ -167,6 +167,15 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
|
|
167
167
|
end
|
168
168
|
end
|
169
169
|
|
170
|
+
local waitLen = rcall("LLEN", KEYS[1])
|
171
|
+
if waitLen == 0 then
|
172
|
+
local activeLen = rcall("LLEN", KEYS[2])
|
173
|
+
|
174
|
+
if activeLen == 0 then
|
175
|
+
rcall("XADD", KEYS[4], "*", "event", "drained")
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
170
179
|
return 0
|
171
180
|
else
|
172
181
|
return -1
|
@@ -72,20 +72,16 @@ local function moveJobFromWaitToActive(keys, keyPrefix, jobId, processedOn, opts
|
|
72
72
|
|
73
73
|
local jobKey = keyPrefix .. jobId
|
74
74
|
local lockKey = jobKey .. ':lock'
|
75
|
-
|
75
|
+
|
76
76
|
-- get a lock
|
77
77
|
if opts['token'] ~= "0" then
|
78
78
|
rcall("SET", lockKey, opts['token'], "PX", opts['lockDuration'])
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
81
|
rcall("ZREM", keys[3], jobId) -- remove from priority
|
82
82
|
rcall("XADD", keys[4], "*", "event", "active", "jobId", jobId, "prev", "waiting")
|
83
83
|
rcall("HSET", jobKey, "processedOn", processedOn)
|
84
84
|
rcall("HINCRBY", jobKey, "attemptsMade", 1)
|
85
|
-
local len = rcall("LLEN", keys[1])
|
86
|
-
if len == 0 then
|
87
|
-
rcall("XADD", keys[4], "*", "event", "drained");
|
88
|
-
end
|
89
85
|
|
90
86
|
return {rcall("HGETALL", jobKey), jobId} -- get job data
|
91
87
|
end
|
@@ -167,6 +167,15 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
|
|
167
167
|
end
|
168
168
|
end
|
169
169
|
|
170
|
+
local waitLen = rcall("LLEN", KEYS[1])
|
171
|
+
if waitLen == 0 then
|
172
|
+
local activeLen = rcall("LLEN", KEYS[2])
|
173
|
+
|
174
|
+
if activeLen == 0 then
|
175
|
+
rcall("XADD", KEYS[4], "*", "event", "drained")
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
170
179
|
return 0
|
171
180
|
else
|
172
181
|
return -1
|