daemon: extract task bus and make slot waits cancellable #1932
Notifications
Due Date
No due date set.
Blocks
#1920 Effective Go: critical paths
sam/archie
Reference: sam/archie#1932
Reference in new issue
Block a user
Move the task bus and dispatcher off Daemon, built in the constructor instead of sync.Once. reacquire and the wait on the previous run in a repo chain ignore ctx, so a cancelled run can hold or wait for a slot forever; select on ctx.Done().
Done when Daemon holds a pointer to it and both waits return on cancellation.
Done in
500d02be: the task bus and dispatcher are their own type, built in the constructor (no sync.Once). A run queued behind its repo chain, and a resumed run reacquiring capacity, now return on ctx cancellation and give back what they hold; TestCancelledRunQueuedBehindItsRepoReturns hung on the old code. reacquire gets the call-wait watcher's ctx, so only shutdown (not a per-task stop) interrupts it; filed separately. task check passed.