1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 19:44:01 +08:00

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: Steven Allen <steven@stebalien.com>
This commit is contained in:
Steven Allen
2017-12-03 18:29:50 -08:00
parent 39f0f5f796
commit 8e780d2304

View File

@ -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