Skip to content

Commit

Permalink
fix pin-lock in dag put
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
  • Loading branch information
Stebalien committed Oct 27, 2018
1 parent b8d7d25 commit a0c0355
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/commands/dag/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash"
path "gx/ipfs/QmRKuTyCzg7HFBcV1YUhzStroGtJSb8iWgyxfsDCwFhWTS/go-path"
cmds "gx/ipfs/QmSXUokcP4TJpFfqozT69AVAYRtzXVMUjzQVkYX41R9Svs/go-ipfs-cmds"
files "gx/ipfs/QmZMWMvWMVKCbHetJ4RgndbuEF1io2UpUxwQwtNjtYPzSC/go-ipfs-files"
ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format"
cmdkit "gx/ipfs/Qmde5VP1qUkyQXKCfmEUA7bP64V2HAptbJ7phuPp7jXWwg/go-ipfs-cmdkit"
)
Expand Down Expand Up @@ -89,6 +88,10 @@ into an object of the specified format.
cids := cid.NewSet()
b := ipld.NewBatch(req.Context, nd.DAG)

if dopin {
defer nd.Blockstore.PinLock().Unlock()
}

for {
file, err := req.Files.NextFile()
if err == io.EOF {
Expand Down Expand Up @@ -125,8 +128,6 @@ into an object of the specified format.
}

if dopin {
defer nd.Blockstore.PinLock().Unlock()

cids.ForEach(func(c cid.Cid) error {
nd.Pinning.PinWithMode(c, pin.Recursive)
return nil
Expand Down

0 comments on commit a0c0355

Please sign in to comment.