Commit 254ac1b1 authored by Michael Avila's avatar Michael Avila Committed by Steven Allen

Fix inability to pin two things at once

License: MIT
Signed-off-by: default avatarMichael Avila <me@michaelavila.com>
parent 86559e9e
......@@ -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
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment