forked from TrueCloudLab/neoneo-go
cli/server: close the chain gracefully on restore even on error
Not an issue for dumper, but when restoring we should correctly save everything already imported even if the subsequent block fails.
This commit is contained in:
parent
1f4b7b366e
commit
f15a2401b1
1 changed files with 3 additions and 3 deletions
|
@ -233,6 +233,9 @@ func restoreDB(ctx *cli.Context) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer chain.Close()
|
||||
defer prometheus.ShutDown()
|
||||
defer pprof.ShutDown()
|
||||
|
||||
var allBlocks = reader.ReadU32LE()
|
||||
if reader.Err != nil {
|
||||
|
@ -271,9 +274,6 @@ func restoreDB(ctx *cli.Context) error {
|
|||
return cli.NewExitError(fmt.Errorf("failed to add block %d: %s", i, err), 1)
|
||||
}
|
||||
}
|
||||
pprof.ShutDown()
|
||||
prometheus.ShutDown()
|
||||
chain.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue