Skip to content

Commit 746e196

Browse files
committed
fix(pool): close bad conn on put and on release when closed
1 parent 88d5d16 commit 746e196

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

clickhouse.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ func (ch *clickhouse) release(conn nativeTransport, err error) {
368368
}
369369

370370
if ch.closed.Load() {
371+
conn.close()
371372
return
372373
}
373374

pool.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ func (i *idlePool) Get(ctx context.Context) (nativeTransport, error) {
7979

8080
func (i *idlePool) Put(conn nativeTransport) {
8181
if i.isExpired(conn) || conn.isBad() {
82+
conn.close()
8283
return
8384
}
8485

0 commit comments

Comments
 (0)