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
0c12b7a0
Commit
0c12b7a0
authored
Feb 19, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move blocking calls out of single threaded loops, cancel contexts ASAP
parent
74d015bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
merkledag.go
merkledag.go
+5
-1
No files found.
merkledag.go
View file @
0c12b7a0
...
...
@@ -187,9 +187,12 @@ func (ds *dagService) GetNodes(ctx context.Context, keys []u.Key) []NodeGetter {
}
go
func
()
{
ctx
,
cancel
:=
context
.
WithCancel
(
ctx
)
defer
cancel
()
blkchan
:=
ds
.
Blocks
.
GetBlocks
(
ctx
,
keys
)
for
{
for
count
:=
0
;
count
<
len
(
keys
);
{
select
{
case
blk
,
ok
:=
<-
blkchan
:
if
!
ok
{
...
...
@@ -205,6 +208,7 @@ func (ds *dagService) GetNodes(ctx context.Context, keys []u.Key) []NodeGetter {
is
:=
FindLinks
(
keys
,
blk
.
Key
(),
0
)
for
_
,
i
:=
range
is
{
sendChans
[
i
]
<-
nd
count
++
}
case
<-
ctx
.
Done
()
:
return
...
...
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