Skip to content

Commit

Permalink
Fix inability to pin two things at once
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Michael Avila <me@michaelavila.com>
  • Loading branch information
michaelavila committed Sep 23, 2018
1 parent 73ac4a8 commit 55338e6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pin/pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 55338e6

Please sign in to comment.