@teamscala/service-boot 0.23.527 → 0.23.528
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 +3 -2
package/package.json
CHANGED
package/src/pg-boss-mount.ts
CHANGED
|
@@ -61,6 +61,7 @@ export function intervalToCron(intervalSeconds: number): string {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
async function resolveHandler(
|
|
64
|
+
boss: PgBoss,
|
|
64
65
|
jobHandlers: ReadonlyMap<string, JobHandler>,
|
|
65
66
|
handlerSlug: string,
|
|
66
67
|
config: ScheduledJobConfig,
|
|
@@ -73,7 +74,7 @@ async function resolveHandler(
|
|
|
73
74
|
`register it with ctx.registerJobHandler(slug, fn) in its package mount`,
|
|
74
75
|
);
|
|
75
76
|
}
|
|
76
|
-
return await handler({ config, jobData });
|
|
77
|
+
return await handler({ config, jobData, sendJob: (queue, data) => boss.send(queue, data) });
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
export async function mountPgBoss(
|
|
@@ -146,7 +147,7 @@ export async function mountPgBoss(
|
|
|
146
147
|
await boss.work(queueName, async (jobs) => {
|
|
147
148
|
let result: unknown;
|
|
148
149
|
for (const job of jobs) {
|
|
149
|
-
result = await resolveHandler(ctx.jobHandlers, config.handler_slug, config, job.data);
|
|
150
|
+
result = await resolveHandler(boss, ctx.jobHandlers, config.handler_slug, config, job.data);
|
|
150
151
|
}
|
|
151
152
|
return jobs.length === 1 ? result : undefined;
|
|
152
153
|
});
|