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
b1b06bd6
Unverified
Commit
b1b06bd6
authored
Nov 08, 2018
by
Steven Allen
Committed by
GitHub
Nov 08, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #19 from ipfs/bugs/fix-leftover-go-routines
Wait for all go routines to finish before function returns
parents
7e8e37de
d845d6a2
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 @
b1b06bd6
...
@@ -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