-
Austin Clements authored
Currently TestDoDupSuppress can fail if the goroutines created by its loop run sequentially. This is rare, but it has caused failures on the dashboard and in stress testing. While I think there's no way to eliminate all possible thread schedules that could make this test fail because it depends on waiting until a Group.Do blocks, it is possible to make it much more robust. This commit deflakes this test by forcing at least one invocation of fn to start and all goroutines to reach the line just before the Do call before allowing fn to proceed. fn then waits 10 milliseconds before returning to allow the goroutines to pass through the Do. With this change, in 50,000 runs of the stress testing configuration, the number of calls to fn never even exceeded 1. Fixes #11784. Change-Id: Ie5adf5764545050ec407619769a656251c4cff04 Reviewed-on: https://go-review.googlesource.com/12681Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
e3ba0977
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
singleflight.go | ||
singleflight_test.go |