mirror of
https://github.com/ipfs/kubo.git
synced 2025-09-09 19:32:24 +08:00
Fix 'ctx, _' to have explicit cancel
License: MIT Signed-off-by: rht <rhtbot@gmail.com>
This commit is contained in:
@ -42,7 +42,8 @@ func TestBlocks(t *testing.T) {
|
||||
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())
|
||||
if err != nil {
|
||||
t.Error("failed to retrieve block from BlockService", err)
|
||||
@ -75,7 +76,8 @@ func TestGetBlocksSequential(t *testing.T) {
|
||||
t.Log("one instance at a time, get blocks concurrently")
|
||||
|
||||
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)
|
||||
gotten := make(map[key.Key]*blocks.Block)
|
||||
for blk := range out {
|
||||
|
Reference in New Issue
Block a user