Skip to content

fix: reject runner.promise when the worker pool or cron exits with an error - #648

Open
Krrishkumar125 wants to merge 1 commit into
graphile:mainfrom
Krrishkumar125:fix/runner-promise-rejects-on-pool-error
Open

Krrishkumar125 wants to merge 1 commit into
graphile:mainfrom
Krrishkumar125:fix/runner-promise-rejects-on-pool-error

Conversation

@Krrishkumar125

Copy link
Copy Markdown

Fixes #635.

Since 0.17.0, buildRunner turns a worker pool (or cron) rejection into a stop(...) call and then .catch(noop)s it, so Promise.all([cp, wp]) always resolves. runner.promise therefore resolves after a fatal pool error, and the CLI exits 0.

Change: the exit handlers still call stop() with the same log reason, but on the error path they re-throw the original error (and only swallow a failure of stop() itself). The existing rejection branch of Promise.all then runs and runner.promise rejects with the pool's error. The clean-exit path is unchanged.

Tests (__tests__/runner.promise.test.ts):

  • the reproduction from the issue (a trigger refuses job completion, completeJobBatchDelay: 0): fails on main with "resolved", passes with this change
  • runner.stop() still resolves runner.promise

Full suite passes locally on PostgreSQL 16 (24 suites, 107 tests), plus yarn lint (no new warnings) and yarn prepack. Added a patch changeset.

@priyansh00soni asked to take this on Oct 3; I didn't see a PR since, but happy to close this if you already have one in progress.

Copilot AI balanced review requested due to automatic review settings October 21, 2026 20:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

runner.promise resolves when the worker pool exits with an error

2 participants