Skip to content

Commit a30e647

Browse files
committed
ignore pgx healthcheck goroutines in goleak
1 parent 8c8cbd6 commit a30e647

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

dbos/system_database.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,6 @@ func (s *sysDB) shutdown(ctx context.Context, timeout time.Duration) {
363363
}
364364

365365
s.notificationsMap.Clear()
366-
// Allow pgx health checks to complete
367-
// https://github.com/jackc/pgx/blob/15bca4a4e14e0049777c1245dba4c16300fe4fd0/pgxpool/pool.go#L417
368-
// These trigger go-leak alerts
369-
time.Sleep(500 * time.Millisecond)
370366

371367
s.launched = false
372368
}

dbos/utils_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ func setupDBOS(t *testing.T, dropDB bool, checkLeaks bool) DBOSContext {
7474
}
7575
dbosCtx = nil
7676
if checkLeaks {
77-
goleak.VerifyNone(t)
77+
goleak.VerifyNone(t,
78+
// Ignore pgx health checks
79+
// https://github.com/jackc/pgx/blob/15bca4a4e14e0049777c1245dba4c16300fe4fd0/pgxpool/pool.go#L417
80+
goleak.IgnoreTopFunction("github.com/jackc/pgx/v5/pgxpool.(*Pool).backgroundHealthCheck"),
81+
goleak.IgnoreTopFunction("github.com/jackc/pgx/v5/pgxpool.(*Pool).triggerHealthCheck"),
82+
)
7883
}
7984
})
8085

0 commit comments

Comments
 (0)