mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 11:27:42 +08:00
fix: ensure pin rm takes a lock
This commit is contained in:
parent
ffb8bf4c88
commit
4ead108a80
@ -67,6 +67,10 @@ func (api *PinAPI) Rm(ctx context.Context, p path.Path, opts ...caopts.PinRmOpti
|
||||
return err
|
||||
}
|
||||
|
||||
// Note: after unpin the pin sets are flushed to the blockstore, so we need
|
||||
// to take a lock to prevent a concurrent garbage collection
|
||||
defer api.blockstore.PinLock().Unlock()
|
||||
|
||||
if err = api.pinning.Unpin(ctx, rp.Cid(), settings.Recursive); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user