Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion internal/engine/agent/background_agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ func TestBackgroundAgentPool_StopCancelsInFlight(t *testing.T) {

pool.Stop()

// The registry only drains a task once its spawn fn returns, so poll
// until the cancellation is observed AND the task has exited.
deadline = time.Now().Add(2 * time.Second)
for !cancelled.Load() && time.Now().Before(deadline) {
for (!cancelled.Load() || pool.PendingCount() != 0) && time.Now().Before(deadline) {
time.Sleep(time.Millisecond)
}
if !cancelled.Load() {
Expand Down
Loading