Skip to content

Commit 016ac37

Browse files
committed
only visit nodes in EnumerateChildrenAsync when asked
No idea why this was changed this was introduced in: 08f342e (part of ipfs#3598) License: MIT Signed-off-by: Steven Allen <[email protected]>
1 parent 0ffc583 commit 016ac37

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

merkledag.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -319,17 +319,17 @@ func EnumerateChildrenAsync(ctx context.Context, getLinks GetLinks, c *cid.Cid,
319319
for i := 0; i < FetchGraphConcurrency; i++ {
320320
go func() {
321321
for ic := range feed {
322-
links, err := getLinks(ctx, ic)
323-
if err != nil {
324-
errChan <- err
325-
return
326-
}
327-
328322
setlk.Lock()
329-
unseen := visit(ic)
323+
shouldVisit := visit(ic)
330324
setlk.Unlock()
331325

332-
if unseen {
326+
if shouldVisit {
327+
links, err := getLinks(ctx, ic)
328+
if err != nil {
329+
errChan <- err
330+
return
331+
}
332+
333333
select {
334334
case out <- links:
335335
case <-fetchersCtx.Done():

0 commit comments

Comments
 (0)