diff --git a/pool/pool.go b/pool/pool.go index 4d3cbf0..669970f 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -86,6 +86,8 @@ type client interface { type clientStatus interface { // isHealthy checks if the connection can handle requests. isHealthy() bool + // isDialed checks if the connection was created. + isDialed() bool // setUnhealthy marks client as unhealthy. setUnhealthy() // address return address of endpoint. @@ -2809,7 +2811,9 @@ func (p *Pool) Close() { // close all clients for _, pools := range p.innerPools { for _, cli := range pools.clients { - _ = cli.close() + if cli.isDialed() { + _ = cli.close() + } } } }