repo: Close datastore in Close
This commit is contained in:
parent
83f1a336a6
commit
f2ecb772fa
@ -6,14 +6,13 @@ import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/filecoin-project/go-lotus/api"
|
||||
"github.com/filecoin-project/go-lotus/node/modules"
|
||||
"github.com/filecoin-project/go-lotus/node/modules/testing"
|
||||
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
|
||||
"github.com/filecoin-project/go-lotus/api"
|
||||
"github.com/filecoin-project/go-lotus/node"
|
||||
"github.com/filecoin-project/go-lotus/node/modules"
|
||||
"github.com/filecoin-project/go-lotus/node/modules/testing"
|
||||
"github.com/filecoin-project/go-lotus/node/repo"
|
||||
)
|
||||
|
||||
|
@ -57,7 +57,7 @@ type clientRequest struct {
|
||||
// ClientCloser is used to close Client from further use
|
||||
type ClientCloser func()
|
||||
|
||||
// NewClient creates new josnrpc 2.0 client
|
||||
// NewClient creates new jsonrpc 2.0 client
|
||||
//
|
||||
// handler must be pointer to a struct with function fields
|
||||
// Returned value closes the client connection
|
||||
|
@ -181,6 +181,11 @@ func (fsr *fsLockedRepo) Close() error {
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
return xerrors.Errorf("could not remove API file: %w", err)
|
||||
}
|
||||
if fsr.ds != nil {
|
||||
if err := fsr.ds.Close(); err != nil {
|
||||
return xerrors.Errorf("could not close datastore: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
err = fsr.closer.Close()
|
||||
fsr.closer = nil
|
||||
|
Loading…
Reference in New Issue
Block a user