mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-20 18:54:51 +08:00
Merge pull request #5550 from ipfs/fix/coreapi-pin-lock
take the pinlock when updating pins
This commit is contained in:
@ -22,13 +22,13 @@ func (api *PinAPI) Add(ctx context.Context, p coreiface.Path, opts ...caopts.Pin
|
||||
return err
|
||||
}
|
||||
|
||||
defer api.node.Blockstore.PinLock().Unlock()
|
||||
|
||||
rp, err := api.core().ResolvePath(ctx, p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer api.node.Blockstore.PinLock().Unlock()
|
||||
|
||||
_, err = corerepo.Pin(api.node, api.core(), ctx, []string{rp.Cid().String()}, settings.Recursive)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -77,6 +77,8 @@ func (api *PinAPI) Update(ctx context.Context, from coreiface.Path, to coreiface
|
||||
return err
|
||||
}
|
||||
|
||||
defer api.node.Blockstore.PinLock().Unlock()
|
||||
|
||||
err = api.node.Pinning.Update(ctx, fp.Cid(), tp.Cid(), settings.Unpin)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user