From 0329f12e05ce1b7fafa8756beff2f22ed3cdd98e Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Thu, 2 Apr 2020 21:51:12 -0500 Subject: [PATCH] Remove unneeded goroutine spawn in connection pool destructor fixes #708 --- pgxpool/pool.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pgxpool/pool.go b/pgxpool/pool.go index c038bd0f..0fa7c98f 100644 --- a/pgxpool/pool.go +++ b/pgxpool/pool.go @@ -171,11 +171,9 @@ func ConnectConfig(ctx context.Context, config *Config) (*Pool, error) { return cr, nil }, func(value interface{}) { - go func() { - ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) - value.(*connResource).conn.Close(ctx) - cancel() - }() + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + value.(*connResource).conn.Close(ctx) + cancel() }, config.MaxConns, )