From c614aa5da2d05bbbbd562a00007683dc2671f217 Mon Sep 17 00:00:00 2001 From: sentanos Date: Thu, 27 Jul 2023 00:23:24 -0700 Subject: [PATCH] Release connection on timeout (#1042) --- clickhouse.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clickhouse.go b/clickhouse.go index e28f175fd6..8b18d2ddad 100644 --- a/clickhouse.go +++ b/clickhouse.go @@ -258,6 +258,10 @@ func (ch *clickhouse) acquire(ctx context.Context) (conn *connect, err error) { } select { case <-timer.C: + select { + case <-ch.open: + default: + } return nil, ErrAcquireConnTimeout case conn := <-ch.idle: if conn.isBad() {