@teamscala/service-boot 0.23.308 → 0.23.309
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/package.json +1 -1
- package/src/pg-boss-mount.ts +9 -2
package/package.json
CHANGED
package/src/pg-boss-mount.ts
CHANGED
|
@@ -204,8 +204,15 @@ export async function mountPgBoss(
|
|
|
204
204
|
// underlying SQL is ON CONFLICT DO NOTHING, so calling it on every
|
|
205
205
|
// boot is a safe idempotent assert, never a duplicate-creation error.
|
|
206
206
|
await boss.createQueue(queueName);
|
|
207
|
-
await boss.work(queueName, async (
|
|
208
|
-
|
|
207
|
+
await boss.work(queueName, async (jobs) => {
|
|
208
|
+
let result: unknown;
|
|
209
|
+
for (const job of jobs) {
|
|
210
|
+
result = await resolveHandler(config.handler_slug, config, job.data);
|
|
211
|
+
}
|
|
212
|
+
// pg-boss stores the work handler return as job output when
|
|
213
|
+
// exactly one job was processed (manager.js complete()). For
|
|
214
|
+
// batch/scheduled jobs the return is not stored.
|
|
215
|
+
return jobs.length === 1 ? result : undefined;
|
|
209
216
|
});
|
|
210
217
|
|
|
211
218
|
if (config.cron) {
|