@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 CHANGED
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "name": "@teamscala/service-boot",
8
8
  "type": "module",
9
- "version": "0.23.308",
9
+ "version": "0.23.309",
10
10
  "sideEffects": false,
11
11
  "files": [
12
12
  "src"
@@ -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 (job) => {
208
- return await resolveHandler(config.handler_slug, config, job?.data);
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) {