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
2 changes: 1 addition & 1 deletion limit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ func TestLimit(t *testing.T) {
}
assert.LessOrEqual(t, atomic.AddInt32(&running, 1), int32(max))
time.Sleep(sleep)
done.Done()
assert.GreaterOrEqual(t, atomic.AddInt32(&running, -1), int32(0))
done.Done()
Copy link

Copilot AI Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reordering done.Done() to after the atomic decrement ensures the running counter is updated before signaling completion, which should prevent the race condition. Please verify that this change aligns with the intended test synchronization.

Copilot uses AI. Check for mistakes.
}()
}
wg.Wait()
Expand Down
Loading