Unverified Commit b1b06bd6 authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #19 from ipfs/bugs/fix-leftover-go-routines

Wait for all go routines to finish before function returns
parents 7e8e37de d845d6a2
......@@ -376,14 +376,16 @@ func EnumerateChildrenAsyncDepth(ctx context.Context, getLinks GetLinks, c cid.C
done := make(chan struct{})
var setlk sync.Mutex
var wg sync.WaitGroup
errChan := make(chan error)
fetchersCtx, cancel := context.WithCancel(ctx)
defer wg.Wait()
defer cancel()
for i := 0; i < FetchGraphConcurrency; i++ {
wg.Add(1)
go func() {
defer wg.Done()
for cdepth := range feed {
ci := cdepth.cid
depth := cdepth.depth
......
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