Skip to content

Commit

Permalink
only visit nodes in EnumerateChildrenAsync when asked
Browse files Browse the repository at this point in the history
No idea why this was changed this was introduced in:

08f342e (part of ipfs#3598)

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
  • Loading branch information
Stebalien committed Mar 27, 2018
1 parent 0ffc583 commit 016ac37
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions merkledag.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,17 +319,17 @@ func EnumerateChildrenAsync(ctx context.Context, getLinks GetLinks, c *cid.Cid,
for i := 0; i < FetchGraphConcurrency; i++ {
go func() {
for ic := range feed {
links, err := getLinks(ctx, ic)
if err != nil {
errChan <- err
return
}

setlk.Lock()
unseen := visit(ic)
shouldVisit := visit(ic)
setlk.Unlock()

if unseen {
if shouldVisit {
links, err := getLinks(ctx, ic)
if err != nil {
errChan <- err
return
}

select {
case out <- links:
case <-fetchersCtx.Done():
Expand Down

0 comments on commit 016ac37

Please sign in to comment.