only visit nodes in EnumerateChildrenAsync when asked
No idea why this was changed this was introduced in: 08f342e8bada4f4eb0c5462a3623f0c2b828240f (part of #3598) License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
Steven Allen committed
Mar 27, 2018 at 16:48 UTC
08388e739a2e196e35f823463369ca805c098bcf
1 file changed
+8
-8
merkledag/merkledag.go
+8
-8
@@ -319,17 +319,17 @@ func EnumerateChildrenAsync(ctx context.Context, getLinks GetLinks, c *cid.Cid,
319
for i := 0; i < FetchGraphConcurrency; i++ {
320
go func() {
321
for ic := range feed {
322
- links, err := getLinks(ctx, ic)
323
- if err != nil {
324
- errChan <- err
325
- return
326
- }
327
-
322
setlk.Lock()
329
- unseen := visit(ic)
323
+ shouldVisit := visit(ic)
324
setlk.Unlock()
325
332
- if unseen {
326
+ if shouldVisit {
327
+ links, err := getLinks(ctx, ic)
328
+ if err != nil {
329
+ errChan <- err
330
+ return
331
+ }
332
+
333
select {
334
case out <- links:
335
case <-fetchersCtx.Done():