mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 14:40:52 +00:00
The five hand-written registrars (about 5,500 lines, one 997-line function) are replaced by `jobs/registry/`: one `defineJob` entry per queue with its cron, schedule send options, policy, work options, lock, lane and a handler loader. `registerJobGroup` creates, schedules, retires and binds each group in the order the registrars used; the worker boot walks the groups and runs their boot discovery. Handlers load on their queue's first job. The facts a declaration needs at boot (names, crons, concurrency, send options) moved out of the heavy job modules into light `*-queue.ts` siblings, and their importers point there, so loading the registry evaluates 288 modules instead of the 1,164 the registrars pulled in. The formerly inline handlers moved verbatim into handler modules under `jobs/reminder/`. Fitbit's queues live in `fitbit/jobs/definitions.ts` and enter the registry through one spread, so removing the integration later is that folder and that line. `tests/integration/queue-registration-parity.test.ts` proves pg-boss holds exactly what the registrars left (queues, schedules, bindings, byte for byte) and loads every handler once. The queue tests and the runtime guard assert on the registry objects instead of reading registrar source.
24 lines
812 B
TypeScript
24 lines
812 B
TypeScript
/**
|
|
* The queue facts of `restore-drill.ts`: its name and, where it has them, its
|
|
* schedule, concurrency and send options. They live apart from the job so the
|
|
* worker registry and every sender can read them without loading it.
|
|
*/
|
|
export const RESTORE_DRILL_QUEUE = "data-restore-drill";
|
|
|
|
export const RESTORE_DRILL_CRON = "11 4 1 * *";
|
|
|
|
/**
|
|
* Four hours, the off-host upload's own window: the drill downloads and
|
|
* stream-parses every object that upload wrote in one night.
|
|
*/
|
|
export const RESTORE_DRILL_EXPIRE_SECONDS = 4 * 60 * 60;
|
|
|
|
/**
|
|
* What the monthly schedule sends with: the expiry above and no retry
|
|
* (`retryLimit: 0`, the maintenance schedules' `cronIsTheRetry`).
|
|
*/
|
|
export const RESTORE_DRILL_SEND_OPTIONS = {
|
|
expireInSeconds: RESTORE_DRILL_EXPIRE_SECONDS,
|
|
retryLimit: 0,
|
|
} as const;
|