Skip to content

[workers] InProcessJobRunner abort grace is 1 s and the generated worker cannot change it #2633

Closed

Description

@rickylabs

Summary

InProcessJobRunner waits one second after an abort before it rejects the dispatch, while the handler may still be running. The generated worker process has no way to change that value.

Evidence (main at b0eb079, same on v0.0.9)

  • packages/plugin-workers-core/src/runtime/in-process-job-runner.ts:42: options.abortGracePeriodMs ?? 1_000. It applies to every abort: shutdown, cancel and deadline.
  • plugins/workers/bin/runtime.ts:181 passes only { registry } as workerPoolOptions, so the default always applies in the standard runtime.

Expected behavior

The grace period is configurable through worker configuration, and its default matches the budget the queue and the worker drain already give an in-flight job.

Acceptance

  • Worker configuration exposes the abort grace period and the standard runtime forwards it to the runner.
  • The default is derived from, or documented against, the drain budget, with the reasoning in the JSDoc.
  • A test shows a handler that needs more than one second to clean up after an abort is awaited when the grace period allows it.
  • The workers documentation lists the option and its default.

Acceptance evidence: PR #2645 implementation and local validation. Each checked criterion maps to its fenced acceptance-evidence entry in the PR body. Full supported runtime and independent evaluation remain PR readiness gates.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions