Skip to content

Commit 1112350

Browse files
committed
fix(pool): close bad conn on put and on release when closed
1 parent 71a7247 commit 1112350

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
@@ -359,6 +359,7 @@ func (ch *clickhouse) release(conn nativeTransport, err error) {
359359
}
360360

361361
if ch.closed.Load() {
362+
conn.close()
362363
return
363364
}
364365

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)