Skip to content

Commit 0753c72

Browse files
committed
bugfix: do not recreate a connection immediately
If we create a connection immediately after closing previous, then it can to lead to too frequent connection creation under some configurations [1] and high CPU load. It will be expected to recreate connection with OptsPool.CheckTimeout frequency. 1. #136
1 parent af2d10f commit 0753c72

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

connection_pool/connection_pool.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -702,20 +702,7 @@ func (connPool *ConnectionPool) checker() {
702702
return
703703
}
704704
if e.Conn.ClosedNow() {
705-
addr := e.Conn.Addr()
706-
if conn, _ := connPool.getConnectionFromPool(addr); conn == nil {
707-
continue
708-
}
709-
conn, _ := tarantool.Connect(addr, connPool.connOpts)
710-
if conn != nil {
711-
err := connPool.setConnectionToPool(addr, conn)
712-
if err != nil {
713-
conn.Close()
714-
log.Printf("tarantool: storing connection to %s failed: %s\n", addr, err.Error())
715-
}
716-
} else {
717-
connPool.deleteConnectionFromPool(addr)
718-
}
705+
connPool.deleteConnectionFromPool(e.Conn.Addr())
719706
}
720707
case <-timer.C:
721708
for _, addr := range connPool.addrs {

0 commit comments

Comments
 (0)