mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-09 18:28:08 +08:00
Fix inability to pin two things at once
License: MIT Signed-off-by: Michael Avila <me@michaelavila.com>
This commit is contained in:
parent
86559e9e04
commit
254ac1b118
@ -228,16 +228,20 @@ func (p *pinner) Pin(ctx context.Context, node ipld.Node, recurse bool) error {
|
||||
if p.directPin.Has(c) {
|
||||
p.directPin.Remove(c)
|
||||
}
|
||||
|
||||
p.lock.Unlock()
|
||||
// fetch entire graph
|
||||
err := mdag.FetchGraph(ctx, c, p.dserv)
|
||||
p.lock.Lock()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
p.recursePin.Add(c)
|
||||
} else {
|
||||
if _, err := p.dserv.Get(ctx, c); err != nil {
|
||||
p.lock.Unlock()
|
||||
_, err := p.dserv.Get(ctx, c)
|
||||
p.lock.Lock()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user