Skip to content

Add worker lifecycle controls - #12

Closed
cmilesio wants to merge 4 commits into
mainfrom
feat/worker-maintenance
Closed

Add worker lifecycle controls#12
cmilesio wants to merge 4 commits into
mainfrom
feat/worker-maintenance

Conversation

@cmilesio

@cmilesio cmilesio commented Aug 16, 2026

Copy link
Copy Markdown
Member

What

Adds PauseWorkers and ResumeWorkers to the high-level queue runtime so applications can stop consumer intake without closing producer handles.

  • In-memory worker pools finish active handlers, hold accepted jobs behind a lifecycle gate, and drain those jobs during graceful shutdown.
  • External drivers stop and recreate only the consumer side, restoring handlers, worker counts, observers, and context decoration on resume.
  • SQLite, MySQL, and Postgres now use separate producer and worker runtimes, so durable rows remain pending during both startup and live pauses.
  • Core NATS returns timer-owned delayed work to the broker when a consumer stops instead of making maintenance wait for the full delay.
  • Timed-out pause attempts remain reconcilable: a retry can finish the pause, and resume cannot report success while a backend is still stopped or gated.

Why

Operational maintenance needs to stop work before another backend claim without turning leases into failures, losing accepted in-memory jobs, or making dispatch unavailable. A worker-level lifecycle gives applications one reliable contract across local, SQL, and external queue drivers while preserving normal dispatch behavior and existing queue handles.

@cmilesio
cmilesio force-pushed the feat/worker-maintenance branch from 647e7bf to 8004ba6 Compare August 16, 2026 23:40
@cmilesio

Copy link
Copy Markdown
Member Author

Maintenance mode is now intentionally scoped to HTTP traffic, so GoForj no longer depends on these queue lifecycle changes. Closing this PR rather than landing an unrelated queue redesign; any future worker controls should be designed and reviewed independently.

@cmilesio cmilesio closed this Aug 17, 2026
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.

1 participant