refactor(server): migrate plugin jobs off node-cron

The plugin host's job scheduler now uses the cron package (the one
@nestjs/schedule wraps), so node-cron and @types/node-cron leave the
dependency tree entirely. Verified against both real libraries that the
accepted cron grammar is identical — no plugin's declared schedule tightens —
and pinned that with an unmocked compat test.
This commit is contained in:
jubnl
2026-08-10 22:16:22 +02:00
parent f43aed762d
commit 08dac57577
9 changed files with 136 additions and 40 deletions
@@ -53,7 +53,7 @@ interface Supervised {
lastRss: number; // last reported resident set size (bytes)
routes: PluginRouteInfo[];
jobs: ScheduledJob[]; // declared background jobs (id + cron schedule)
jobTasks?: ReturnType<typeof scheduleJobs>; // live node-cron tasks (only when jobs:run granted)
jobTasks?: ReturnType<typeof scheduleJobs>; // live cron jobs (only when jobs:run granted)
hooks: string[]; // provider hooks the plugin implements (e.g. 'placeDetailProvider')
events: string[]; // core events the plugin subscribes to (names or '*')
exports: string[]; // functions the plugin exposes to dependents (ctx.plugins.call)
@@ -638,7 +638,7 @@ export class PluginSupervisor {
sup.child = null;
// In-flight host→child invokes can never complete now.
this.rejectPending(sup, 'plugin exited');
// The dead child's node-cron tasks keep ticking (node-cron holds them, not the
// The dead child's cron jobs keep ticking (the host holds them, not the
// child). Stop them here — otherwise every crash-restart cycle leaks a task-set
// AND re-schedules a fresh one, so the job fires N+1 times per tick after N
// crashes (duplicate egress/db side effects). kill() already does this for the