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:
@ -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
|
||||
|
Reference in New Issue
Block a user