提交 1f1c68f1 作者: Hlib

Usage of context helper in Blockstore provider

上级 07bf2bda
package node
import (
"context"
"os"
"syscall"
"time"
......@@ -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
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论