[eskit] Command bus: consider graceful drain timeout on Close() #25
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ash/ideas#25
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Red team audit 2026-02-24 found and fixed a panic: send on closed channel race in command.InProcessBus.
Concern
The current fix uses context cancellation to stop workers on Close(). Workers drain buffered envelopes with ErrBusClosed. However, there is no configurable drain timeout — if a handler is stuck (e.g., slow DB), Close() blocks forever on b.wg.Wait().
Suggestion
Add a WithShutdownTimeout(d time.Duration) option that caps how long Close() waits for in-flight handlers before force-killing worker goroutines.
Severity: Low (only affects shutdown path)