Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-merkledag
Commits
d845d6a2
Commit
d845d6a2
authored
Nov 08, 2018
by
hannahhoward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wait for all go routines to finish before function returns
parent
7e8e37de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
merkledag.go
merkledag.go
+4
-2
No files found.
merkledag.go
View file @
d845d6a2
...
@@ -376,14 +376,16 @@ func EnumerateChildrenAsyncDepth(ctx context.Context, getLinks GetLinks, c cid.C
...
@@ -376,14 +376,16 @@ func EnumerateChildrenAsyncDepth(ctx context.Context, getLinks GetLinks, c cid.C
done := make(chan struct{})
done := make(chan struct{})
var setlk sync.Mutex
var setlk sync.Mutex
var wg sync.WaitGroup
errChan := make(chan error)
errChan := make(chan error)
fetchersCtx, cancel := context.WithCancel(ctx)
fetchersCtx, cancel := context.WithCancel(ctx)
defer wg.Wait()
defer cancel()
defer cancel()
for i := 0; i < FetchGraphConcurrency; i++ {
for i := 0; i < FetchGraphConcurrency; i++ {
wg.Add(1)
go func() {
go func() {
defer wg.Done()
for cdepth := range feed {
for cdepth := range feed {
ci := cdepth.cid
ci := cdepth.cid
depth := cdepth.depth
depth := cdepth.depth
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment