Skip to content

Sync main with master#280

Merged
wool-labs[bot] merged 3 commits into
mainfrom
master
Jul 2, 2026
Merged

Sync main with master#280
wool-labs[bot] merged 3 commits into
mainfrom
master

Conversation

@wool-labs

@wool-labs wool-labs Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Auto-generated by the sync branches workflow.

conradbzura and others added 3 commits July 2, 2026 19:01
The worker service runs each dispatch's routine on a loop taken from a
ResourcePool keyed by the constant "worker". The pool used ttl=0, so
the loop's reference count fell to zero at the end of every dispatch
and the finalizer tore the loop and its daemon thread down, only for
the next dispatch to build them again. That per-dispatch churn, and the
task drain the teardown runs, dominate dispatch latency and are
implicated in a cross-loop lock error under concurrency.

Give the pool a positive time-to-live, _WORKER_LOOP_TTL, so one warm
loop and thread serve dispatches within the window and are torn down
only once the loop sits idle past the TTL. An explicit stop still
clears the pool at once, so no loop or thread outlives the service.
Assert one warm worker loop and daemon thread serve two sequential
dispatches, that stopping the service reaps the warm thread with no
factory-displacement warning, and that an idle loop is reaped once its
time-to-live elapses. Add an autouse teardown that reaps any loop a
test leaves warm, draining residual tasks across successive generations
as the production finalizer does, so a cancelled task's follow-up
cleanup is not stranded.
@wool-labs wool-labs Bot merged commit 09c84a3 into main Jul 2, 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