Skip to content

Commit

Permalink
pin: fix concurrent map access race
Browse files Browse the repository at this point in the history
Not sure why this didn't show up sooner.

fixes #6418
  • Loading branch information
Stebalien committed Jun 6, 2019
1 parent 505eeed commit 486f013
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pin/pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,11 +498,17 @@ func LoadPinner(d ds.Datastore, dserv, internal ipld.DAGService) (Pinner, error)

// DirectKeys returns a slice containing the directly pinned keys
func (p *pinner) DirectKeys() []cid.Cid {
p.lock.RLock()
defer p.lock.RUnlock()

return p.directPin.Keys()
}

// RecursiveKeys returns a slice containing the recursively pinned keys
func (p *pinner) RecursiveKeys() []cid.Cid {
p.lock.RLock()
defer p.lock.RUnlock()

return p.recursePin.Keys()
}

Expand Down

0 comments on commit 486f013

Please sign in to comment.