This release strengthens the Worker shutdown and restart lifecycle. worker.stop() now waits until the active processing session is fully quiescent before returning.
Fixed
- Drain Jobs acquired while shutdown is already in progress, ensuring no work escapes graceful shutdown.
- Wait for in-flight acquisitions, executions, finalizations, schedule dispatches, and heartbeat renewals before completing shutdown.
- Keep renewing leases for running or late-acquired Jobs until they finish.
- Serialize restarts with shutdown so a new session cannot acquire Jobs before the previous one has fully stopped.
- Prevent a Worker stopped during initialization from acquiring work.
- Interrupt idle and error delays immediately when stopping.
- Prevent additional Schedule claims and cycle events once shutdown begins.
- Observe Job execution failures as soon as they enter the pool, preventing transient unhandled promise rejections.
Changed
- Each processing run is now isolated in an internal Worker session with explicit lifecycle ownership.
- Heartbeat management has been extracted into a dedicated internal component.
- Queue selection and processing mode are now fixed for the duration of a session. Call
worker.stop()before changing queues or switching between manual (processCycle) and continuous (startorprocess) processing.
No configuration changes or migrations are required.