Skip to content

Commit

Permalink
Do not start connsCleaner on SetConnectionClosed requests. (#950)
Browse files Browse the repository at this point in the history
* Update client.go

* Update client.go
  • Loading branch information
moredure authored Jan 22, 2021
1 parent 70e00dc commit b4b40e9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ func (c *HostClient) doNonNilReqResp(req *Request, resp *Response) (bool, error)
req.URI().DisablePathNormalizing = true
}

cc, err := c.acquireConn(req.timeout)
cc, err := c.acquireConn(req.timeout, req.ConnectionClose())
if err != nil {
return false, err
}
Expand Down Expand Up @@ -1444,7 +1444,7 @@ func (c *HostClient) SetMaxConns(newMaxConns int) {
c.connsLock.Unlock()
}

func (c *HostClient) acquireConn(reqTimeout time.Duration) (cc *clientConn, err error) {
func (c *HostClient) acquireConn(reqTimeout time.Duration, connectionClose bool) (cc *clientConn, err error) {
createConn := false
startCleaner := false

Expand All @@ -1459,7 +1459,7 @@ func (c *HostClient) acquireConn(reqTimeout time.Duration) (cc *clientConn, err
if c.connsCount < maxConns {
c.connsCount++
createConn = true
if !c.connsCleanerRun {
if !c.connsCleanerRun && !connectionClose {
startCleaner = true
c.connsCleanerRun = true
}
Expand Down

0 comments on commit b4b40e9

Please sign in to comment.