From cf006820658cc1e42479d0a69c3cc25dd61238e1 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 18 Jan 2021 12:04:58 +0300 Subject: [PATCH] [#323] cmd/node: Call Close method of the storage engine on app shutdown Signed-off-by: Leonard Lyubich --- cmd/neofs-node/config.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 62407cea..53ea28f9 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -453,6 +453,19 @@ func initLocalStorage(c *cfg) { } c.cfgObject.cfgLocalStorage.localStorage = ls + + c.onShutdown(func() { + c.log.Info("closing components of the storage engine...") + + err := ls.Close() + if err != nil { + c.log.Info("storage engine closing failure", + zap.String("error", err.Error()), + ) + } else { + c.log.Info("all components of the storage engine closed successfully") + } + }) } func initShardOptions(c *cfg) {