Skip to content

Commit 5ee187d

Browse files
authored
bugfix: fix i/o timeout: connection was bad (#605)
* bugfix: fix i/o timeout: connection was bad
1 parent 2eebdb9 commit 5ee187d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

client/pool.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -466,11 +466,12 @@ func (pool *Pool) startNewConnections(count int) {
466466

467467
func (pool *Pool) ping(conn *Conn) error {
468468
deadline := time.Now().Add(100 * time.Millisecond)
469-
_ = conn.SetWriteDeadline(deadline)
470-
_ = conn.SetReadDeadline(deadline)
469+
_ = conn.SetDeadline(deadline)
471470
err := conn.Ping()
472471
if err != nil {
473472
pool.logFunc(`Pool: ping query fail: %s`, err.Error())
473+
} else {
474+
_ = conn.SetDeadline(time.Time{})
474475
}
475476
return err
476477
}

0 commit comments

Comments
 (0)