Skip to content

Commit

Permalink
even more explicit preemption
Browse files Browse the repository at this point in the history
  • Loading branch information
mumbleskates committed Mar 4, 2024
1 parent 54cb279 commit dc44b3b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions racy_collect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ package parallel
import (
"context"
"errors"
"testing"
"time"

"github.com/stretchr/testify/assert"

Check failure on line 8 in racy_collect_test.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/wandb/parallel) -s blank -s dot --custom-order (gci)
"runtime"
"testing"

Check failure on line 10 in racy_collect_test.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gci`-ed with --skip-generated -s standard -s default -s prefix(github.com/wandb/parallel) -s blank -s dot --custom-order (gci)
)

// The tests in this file are detected as racy by the race condition checker
Expand All @@ -27,7 +26,7 @@ func TestGatherErrCanceled(t *testing.T) {
})
// Hack: wait for the error to be definitely collected
for len(*g.(multiErrGroup).res) == 0 {
time.Sleep(0)
runtime.Gosched()
}
cancel()
err := g.Wait()
Expand All @@ -49,7 +48,7 @@ func TestCollectWithErrsCanceled(t *testing.T) {
})
// Hack: wait for the error to be definitely collected
for len(g.(collectingMultiErrGroup[int]).res.errs) == 0 {
time.Sleep(0)
runtime.Gosched()
}
cancel()
_, err := g.Wait()
Expand All @@ -70,7 +69,7 @@ func TestFeedWithErrsCanceled(t *testing.T) {
})
// Hack: wait for the error to be definitely collected
for len(*g.(feedingMultiErrGroup[int]).res) == 0 {
time.Sleep(0)
runtime.Gosched()
}
cancel()
err := g.Wait()
Expand Down

0 comments on commit dc44b3b

Please sign in to comment.