fix: ensure piece store starts before calling lotus accessor methods

This commit is contained in:
Dirk McCormick
2021-07-21 13:31:20 +02:00
parent 1452a361a9
commit 0dbb1940f0
8 changed files with 53 additions and 49 deletions
+3 -2
View File
@@ -591,7 +591,7 @@ func DagStoreWrapper(
Datastore: dagStoreDS,
GCInterval: 5 * time.Minute,
}
mountApi := dagstore.NewLotusMountAPI(pieceStore, rpn)
mountApi := dagstore.NewLotusAccessor(pieceStore, rpn)
dsw, err := dagstore.NewDagStoreWrapper(cfg, mountApi)
if err != nil {
return nil, xerrors.Errorf("failed to create DAG store wrapper: %w", err)
@@ -599,7 +599,8 @@ func DagStoreWrapper(
lc.Append(fx.Hook{
OnStart: func(ctx context.Context) error {
return dsw.Start(ctx)
dsw.Start(ctx)
return nil
},
OnStop: func(context.Context) error {
return dsw.Close()