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-blockservice
Commits
31d8527e
Commit
31d8527e
authored
Aug 23, 2015
by
rht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 'ctx, _' to have explicit cancel
License: MIT Signed-off-by:
rht
<
rhtbot@gmail.com
>
parent
323a2d54
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
test/blocks_test.go
test/blocks_test.go
+4
-2
No files found.
test/blocks_test.go
View file @
31d8527e
...
@@ -42,7 +42,8 @@ func TestBlocks(t *testing.T) {
...
@@ -42,7 +42,8 @@ func TestBlocks(t *testing.T) {
t
.
Error
(
"returned key is not equal to block key"
,
err
)
t
.
Error
(
"returned key is not equal to block key"
,
err
)
}
}
ctx
,
_
:=
context
.
WithTimeout
(
context
.
TODO
(),
time
.
Second
*
5
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
TODO
(),
time
.
Second
*
5
)
defer
cancel
()
b2
,
err
:=
bs
.
GetBlock
(
ctx
,
b
.
Key
())
b2
,
err
:=
bs
.
GetBlock
(
ctx
,
b
.
Key
())
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
"failed to retrieve block from BlockService"
,
err
)
t
.
Error
(
"failed to retrieve block from BlockService"
,
err
)
...
@@ -75,7 +76,8 @@ func TestGetBlocksSequential(t *testing.T) {
...
@@ -75,7 +76,8 @@ func TestGetBlocksSequential(t *testing.T) {
t
.
Log
(
"one instance at a time, get blocks concurrently"
)
t
.
Log
(
"one instance at a time, get blocks concurrently"
)
for
i
:=
1
;
i
<
len
(
servs
);
i
++
{
for
i
:=
1
;
i
<
len
(
servs
);
i
++
{
ctx
,
_
:=
context
.
WithTimeout
(
context
.
TODO
(),
time
.
Second
*
50
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
TODO
(),
time
.
Second
*
50
)
defer
cancel
()
out
:=
servs
[
i
]
.
GetBlocks
(
ctx
,
keys
)
out
:=
servs
[
i
]
.
GetBlocks
(
ctx
,
keys
)
gotten
:=
make
(
map
[
key
.
Key
]
*
blocks
.
Block
)
gotten
:=
make
(
map
[
key
.
Key
]
*
blocks
.
Block
)
for
blk
:=
range
out
{
for
blk
:=
range
out
{
...
...
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