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>
Steven Allen committed
Dec 3, 2017 at 18:29 UTC
8e780d2304243acaf455cf22ba46395685e2063e
1 file changed
-4
core/corerepo/pinning.go
-4
@@ -50,8 +50,6 @@ func Pin(n *core.IpfsNode, ctx context.Context, paths []string, recursive bool)
50
for _, dagnode := range dagnodes {
51
c := dagnode.Cid()
52
53
- ctx, cancel := context.WithCancel(ctx)
54
- defer cancel()
53
err := n.Pinning.Pin(ctx, dagnode, recursive)
54
if err != nil {
55
return nil, fmt.Errorf("pin: %s", err)
@@ -86,8 +84,6 @@ func Unpin(n *core.IpfsNode, ctx context.Context, paths []string, recursive bool
84
return nil, err
85
}
86
89
- ctx, cancel := context.WithCancel(ctx)
90
- defer cancel()
87
err = n.Pinning.Unpin(ctx, k, recursive)
88
if err != nil {
89
return nil, err