Skip to content

Commit

Permalink
Merge pull request #3 from wandb/more-explicit-preemption
Browse files Browse the repository at this point in the history
more explicit preemption in parallel test
  • Loading branch information
mumbleskates authored Mar 4, 2024
2 parents 1fc3f0d + 1d5b14e commit 54cb279
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gotest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.20', '1.21.x' ]
go-version: [ '1.20', '1.21.x', '1.22.x' ]

steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package parallel

import (
"context"
"runtime"
"sync"
"sync/atomic"
"testing"
"time"

"github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -148,9 +148,9 @@ func testLimitedGroupMaxConcurrency(t *testing.T, name string, g Executor, limit
// All the workers we *expect* to see have shown up now. Throw away all
// the poison pills in the ops queue
for poisonPill := range g.(*limitedGroup).ops {
time.Sleep(0) // Trigger preemption as much as we can
runtime.Gosched() // Trigger preemption as much as we can
assert.NotNil(t, poisonPill)
time.Sleep(0) // Trigger preemption as much as we can
runtime.Gosched() // Trigger preemption as much as we can
}
blocker.Done() // unblock the workers
if shouldSucceed {
Expand Down

0 comments on commit 54cb279

Please sign in to comment.