[#323] cmd/node: Call Close method of the storage engine on app shutdown
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
9f41192bff
commit
cf00682065
1 changed files with 13 additions and 0 deletions
|
@ -453,6 +453,19 @@ func initLocalStorage(c *cfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
c.cfgObject.cfgLocalStorage.localStorage = ls
|
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) {
|
func initShardOptions(c *cfg) {
|
||||||
|
|
Loading…
Reference in a new issue