Skip to content

Commit

Permalink
bugfix: do not recreate a connection immediately
Browse files Browse the repository at this point in the history
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
  • Loading branch information
oleg-jukovec committed Aug 18, 2022
1 parent af2d10f commit 0753c72
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions connection_pool/connection_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,20 +702,7 @@ func (connPool *ConnectionPool) checker() {
return
}
if e.Conn.ClosedNow() {
addr := e.Conn.Addr()
if conn, _ := connPool.getConnectionFromPool(addr); conn == nil {
continue
}
conn, _ := tarantool.Connect(addr, connPool.connOpts)
if conn != nil {
err := connPool.setConnectionToPool(addr, conn)
if err != nil {
conn.Close()
log.Printf("tarantool: storing connection to %s failed: %s\n", addr, err.Error())
}
} else {
connPool.deleteConnectionFromPool(addr)
}
connPool.deleteConnectionFromPool(e.Conn.Addr())
}
case <-timer.C:
for _, addr := range connPool.addrs {
Expand Down

0 comments on commit 0753c72

Please sign in to comment.