Commit 6598da30 authored by Whyrusleeping's avatar Whyrusleeping Committed by GitHub

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

only visit nodes in EnumerateChildrenAsync when asked
parents 5044152b 016ac37d
...@@ -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 is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment