Skip to content

Commit 49a8601

Browse files
committed
Try to pacify finicky timing test on CI
1 parent 097b6aa commit 49a8601

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pgxpool/pool_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,14 @@ func TestPoolBackgroundChecksMaxConnIdleTime(t *testing.T) {
389389
c, err := db.Acquire(context.Background())
390390
require.NoError(t, err)
391391
c.Release()
392-
time.Sleep(config.HealthCheckPeriod + 500*time.Millisecond)
392+
time.Sleep(config.HealthCheckPeriod)
393+
394+
for i := 0; i < 1000; i++ {
395+
if db.Stat().TotalConns() == 0 {
396+
break
397+
}
398+
time.Sleep(time.Millisecond)
399+
}
393400

394401
stats := db.Stat()
395402
assert.EqualValues(t, 0, stats.TotalConns())

0 commit comments

Comments
 (0)