Unverified 提交 d82bf5f5 作者: Whyrusleeping 提交者: GitHub

Merge pull request #4885 from ipfs/fix/visit-when-asked

only visit nodes in EnumerateChildrenAsync when asked
...@@ -319,17 +319,17 @@ func EnumerateChildrenAsync(ctx context.Context, getLinks GetLinks, c *cid.Cid, ...@@ -319,17 +319,17 @@ func EnumerateChildrenAsync(ctx context.Context, getLinks GetLinks, c *cid.Cid,
for i := 0; i < FetchGraphConcurrency; i++ { for i := 0; i < FetchGraphConcurrency; i++ {
go func() { go func() {
for ic := range feed { for ic := range feed {
setlk.Lock()
shouldVisit := visit(ic)
setlk.Unlock()
if shouldVisit {
links, err := getLinks(ctx, ic) links, err := getLinks(ctx, ic)
if err != nil { if err != nil {
errChan <- err errChan <- err
return return
} }
setlk.Lock()
unseen := visit(ic)
setlk.Unlock()
if unseen {
select { select {
case out <- links: case out <- links:
case <-fetchersCtx.Done(): case <-fetchersCtx.Done():
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论