groupmq-plus 1.1.0 → 1.1.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/index.cjs +127 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -3
- package/dist/index.d.ts +22 -3
- package/dist/index.js +127 -3
- package/dist/index.js.map +1 -1
- package/dist/lua/complete-and-reserve-next-with-metadata.lua +8 -0
- package/dist/lua/complete-with-metadata.lua +8 -0
- package/dist/lua/record-job-result.lua +10 -0
- package/package.json +1 -1
|
@@ -145,6 +145,14 @@ elseif status == "failed" then
|
|
|
145
145
|
end
|
|
146
146
|
end
|
|
147
147
|
|
|
148
|
+
-- Publish completion/failure event for waiters
|
|
149
|
+
local eventPayload = cjson.encode({
|
|
150
|
+
id = completedJobId,
|
|
151
|
+
status = status,
|
|
152
|
+
result = resultOrError
|
|
153
|
+
})
|
|
154
|
+
redis.call("PUBLISH", ns .. ":events", eventPayload)
|
|
155
|
+
|
|
148
156
|
-- Part 3: Handle group active list and get next job (BullMQ-style)
|
|
149
157
|
local groupActiveKey = ns .. ":g:" .. gid .. ":active"
|
|
150
158
|
local activeJobId = redis.call("LINDEX", groupActiveKey, 0)
|
|
@@ -186,5 +186,13 @@ elseif status == "failed" then
|
|
|
186
186
|
end
|
|
187
187
|
end
|
|
188
188
|
|
|
189
|
+
-- Publish completion/failure event for waiters
|
|
190
|
+
local eventPayload = cjson.encode({
|
|
191
|
+
id = jobId,
|
|
192
|
+
status = status,
|
|
193
|
+
result = resultOrError
|
|
194
|
+
})
|
|
195
|
+
redis.call("PUBLISH", ns .. ":events", eventPayload)
|
|
196
|
+
|
|
189
197
|
return 1
|
|
190
198
|
|
|
@@ -139,5 +139,15 @@ elseif status == "failed" then
|
|
|
139
139
|
end
|
|
140
140
|
end
|
|
141
141
|
|
|
142
|
+
-- Publish completion/failure event for waiters
|
|
143
|
+
if status == "completed" or status == "failed" then
|
|
144
|
+
local eventPayload = cjson.encode({
|
|
145
|
+
id = jobId,
|
|
146
|
+
status = status,
|
|
147
|
+
result = resultOrError
|
|
148
|
+
})
|
|
149
|
+
redis.call("PUBLISH", ns .. ":events", eventPayload)
|
|
150
|
+
end
|
|
151
|
+
|
|
142
152
|
return 1
|
|
143
153
|
|