forked from TrueCloudLab/frostfs-sdk-go
[#171] pool: Close only dialed connections
To avoid panics during close operation, close only dialed connections. Signed-off-by: Alex Vanin <a.vanin@yadro.com>
This commit is contained in:
parent
ddbfb758c9
commit
8a04638749
1 changed files with 5 additions and 1 deletions
|
@ -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,10 +2811,12 @@ func (p *Pool) Close() {
|
|||
// close all clients
|
||||
for _, pools := range p.innerPools {
|
||||
for _, cli := range pools.clients {
|
||||
if cli.isDialed() {
|
||||
_ = cli.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SyncContainerWithNetwork applies network configuration received via
|
||||
// the Pool to the container. Changes the container if it does not satisfy
|
||||
|
|
Loading…
Reference in a new issue