Usage of context helper in Blockstore provider
Hlib committed
Jun 4, 2019 at 16:11 UTC
1f1c68f16eaa57d6a66fd9a7f1de5a2159c6dc7f
1 file changed
+1
-10
core/node/storage.go
+1
-10
@@ -1,7 +1,6 @@
1
package node
2
3
import (
4
- "context"
4
"os"
5
"syscall"
6
"time"
@@ -55,15 +54,7 @@ func BaseBlockstoreCtor(cacheOpts blockstore.CacheOpts, nilRepo bool, hashOnRead
54
bs = &verifbs.VerifBS{Blockstore: bs}
55
56
if !nilRepo {
58
- ctx, cancel := context.WithCancel(mctx)
59
-
60
- lc.Append(fx.Hook{
61
- OnStop: func(context context.Context) error {
62
- cancel()
63
- return nil
64
- },
65
- })
66
- bs, err = blockstore.CachedBlockstore(ctx, bs, cacheOpts)
57
+ bs, err = blockstore.CachedBlockstore(helpers.LifecycleCtx(mctx, lc), bs, cacheOpts)
58
if err != nil {
59
return nil, err
60
}