Skip to content

refactor(worker): introduce Supervisor for batched task claiming#10

Open
Christian Hartung (hartungstenio) wants to merge 2 commits into
mainfrom
feat/spawn
Open

refactor(worker): introduce Supervisor for batched task claiming#10
Christian Hartung (hartungstenio) wants to merge 2 commits into
mainfrom
feat/spawn

Conversation

@hartungstenio

Copy link
Copy Markdown
Contributor

No description provided.

Extract Supervisor class to manage the worker pool lifecycle: task
claiming, queue feeding, batch mode, max-tasks tracking, and
graceful/forced shutdown.

Worker is simplified to only consume tasks from a shared asyncio.Queue.
The Supervisor issues a single SELECT FOR UPDATE SKIP LOCKED per poll
cycle to claim up to `concurrency` tasks at once, reducing database
load compared to each worker querying the DB independently.

Also fix _force_shutdown task not being cancelled on graceful shutdown,
and pending work_task left in TaskGroup causing a hang on stop.
Move initial release content to [0.0.1] - 2026-04-30 and document
post-release changes under [Unreleased]: Supervisor architecture,
batched task claiming, and direct dependency declarations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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