Skip to content

Commit

Permalink
Merge pull request #6399 from Wondertan/fix/lifecycle-helper
Browse files Browse the repository at this point in the history
Usage of context helper in Blockstore provider
  • Loading branch information
Stebalien authored Jun 4, 2019
2 parents 03e2eee + 1f1c68f commit 5311ac0
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions core/node/storage.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package node

import (
"context"
"os"
"syscall"
"time"
Expand Down Expand Up @@ -55,15 +54,7 @@ func BaseBlockstoreCtor(cacheOpts blockstore.CacheOpts, nilRepo bool, hashOnRead
bs = &verifbs.VerifBS{Blockstore: bs}

if !nilRepo {
ctx, cancel := context.WithCancel(mctx)

lc.Append(fx.Hook{
OnStop: func(context context.Context) error {
cancel()
return nil
},
})
bs, err = blockstore.CachedBlockstore(ctx, bs, cacheOpts)
bs, err = blockstore.CachedBlockstore(helpers.LifecycleCtx(mctx, lc), bs, cacheOpts)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 5311ac0

Please sign in to comment.