From a7e799394764005fd8e32d0930a2cc78a9fb854c Mon Sep 17 00:00:00 2001 From: tsushanth Date: Mon, 20 Jul 2026 13:25:09 -0700 Subject: [PATCH] fix: catch unhandled rejection from dispatcher polling loop start() called void this.listen() with no .catch(). listen() awaits DB calls without a try/catch, so a transient connection error causes the loop to exit and the rejection to surface as an unhandled rejection. In Node >= 15 this crashes the process; in older Node it silently kills the polling loop and jobs pile up in waiting state with no recovery. The same file already handles this correctly for job execution: void this.executorManager.execute(queue, job).catch((error: unknown) => { logger("Dispatcher").error(`Unexpected error executing job ${job.id}:`, error); }); Apply the same pattern to start(). --- packages/engine/src/execution/dispatcher.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/engine/src/execution/dispatcher.ts b/packages/engine/src/execution/dispatcher.ts index eec75ba3..dffc6bd3 100644 --- a/packages/engine/src/execution/dispatcher.ts +++ b/packages/engine/src/execution/dispatcher.ts @@ -90,7 +90,9 @@ export class Dispatcher { start() { logger("Dispatcher").debug(`Starting dispatcher...`); this.isRunning = true; - void this.listen(); + void this.listen().catch((error: unknown) => { + logger("Dispatcher").error("Dispatcher polling loop crashed unexpectedly:", error); + }); } /**