forked from TrueCloudLab/frostfs-node
[#567] innerring: Close cached clients on shutdown
Register `CloseAll` method to be called on IR application shutdown. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
9b2939d538
commit
49a42b1d3e
2 changed files with 10 additions and 0 deletions
|
@ -235,6 +235,13 @@ func (s *Server) Stop() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *Server) registerNoErrCloser(c func()) {
|
||||
s.registerCloser(func() error {
|
||||
c()
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Server) registerIOCloser(c io.Closer) {
|
||||
s.registerCloser(c.Close)
|
||||
}
|
||||
|
@ -393,6 +400,8 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error
|
|||
RangeTimeout: cfg.GetDuration("audit.timeout.rangehash"),
|
||||
})
|
||||
|
||||
server.registerNoErrCloser(clientCache.cache.CloseAll)
|
||||
|
||||
pdpPoolSize := cfg.GetInt("audit.pdp.pairs_pool_size")
|
||||
porPoolSize := cfg.GetInt("audit.por.pool_size")
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ type (
|
|||
log *zap.Logger
|
||||
cache interface {
|
||||
Get(address *network.Address) (client.Client, error)
|
||||
CloseAll()
|
||||
}
|
||||
key *ecdsa.PrivateKey
|
||||
|
||||
|
|
Loading…
Reference in a new issue