Commit 8e780d23 authored by Steven Allen's avatar Steven Allen

don't create a new context per pin

This came from an old commit that used a TODO context. Now that we have a real
context, use that.

License: MIT
Signed-off-by: default avatarSteven Allen <steven@stebalien.com>
parent 39f0f5f7
......@@ -50,8 +50,6 @@ func Pin(n *core.IpfsNode, ctx context.Context, paths []string, recursive bool)
for _, dagnode := range dagnodes {
c := dagnode.Cid()
ctx, cancel := context.WithCancel(ctx)
defer cancel()
err := n.Pinning.Pin(ctx, dagnode, recursive)
if err != nil {
return nil, fmt.Errorf("pin: %s", err)
......@@ -86,8 +84,6 @@ func Unpin(n *core.IpfsNode, ctx context.Context, paths []string, recursive bool
return nil, err
}
ctx, cancel := context.WithCancel(ctx)
defer cancel()
err = n.Pinning.Unpin(ctx, k, recursive)
if err != nil {
return nil, err
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment