Skip to content

Commit

Permalink
dont ignore cancel funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
whyrusleeping committed Jun 1, 2015
1 parent 8fa1cae commit bb65900
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/commands/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,13 @@ resulting object hash.
return
}

ctx, _ := context.WithTimeout(req.Context().Context, time.Second*30)
ctx, cancel := context.WithTimeout(req.Context().Context, time.Second*30)
rnode, err := nd.DAG.Get(ctx, rhash)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
cancel()

switch req.Arguments()[1] {
case "add-link":
Expand All @@ -467,12 +468,13 @@ resulting object hash.
}

k := u.Key(hchild)
ctx, _ := context.WithTimeout(req.Context().Context, time.Second*30)
ctx, cancel := context.WithTimeout(req.Context().Context, time.Second*30)
childnd, err := nd.DAG.Get(ctx, k)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
cancel()

err = rnode.AddNodeLinkClean(req.Arguments()[2], childnd)
if err != nil {
Expand Down

0 comments on commit bb65900

Please sign in to comment.