diff --git a/stress_test.go b/stress_test.go index 3b14b587..67642b3e 100644 --- a/stress_test.go +++ b/stress_test.go @@ -44,9 +44,11 @@ func TestStressConnPool(t *testing.T) { {"reset", func(p *pgx.ConnPool, n int) error { p.Reset(); return nil }}, } - actionCount := 5000 + var timer *time.Timer if testing.Short() { - actionCount /= 10 + timer = time.NewTimer(5 * time.Second) + } else { + timer = time.NewTimer(60 * time.Second) } workerCount := 16 @@ -70,8 +72,11 @@ func TestStressConnPool(t *testing.T) { go work() } - for i := 0; i < actionCount; i++ { + var stop bool + for i := 0; !stop; i++ { select { + case <-timer.C: + stop = true case workChan <- i: case err := <-errChan: close(workChan)