fix pin-lock in dag put
License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
Steven Allen committed
Oct 26, 2018 at 13:02 UTC
a0c0355dd59f8b92f4f88e6cf6d7195d8d9976ec
1 file changed
+4
-3
core/commands/dag/dag.go
+4
-3
@@ -13,7 +13,6 @@ import (
13
mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash"
14
path "gx/ipfs/QmRKuTyCzg7HFBcV1YUhzStroGtJSb8iWgyxfsDCwFhWTS/go-path"
15
cmds "gx/ipfs/QmSXUokcP4TJpFfqozT69AVAYRtzXVMUjzQVkYX41R9Svs/go-ipfs-cmds"
16
- files "gx/ipfs/QmZMWMvWMVKCbHetJ4RgndbuEF1io2UpUxwQwtNjtYPzSC/go-ipfs-files"
16
ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format"
17
cmdkit "gx/ipfs/Qmde5VP1qUkyQXKCfmEUA7bP64V2HAptbJ7phuPp7jXWwg/go-ipfs-cmdkit"
18
)
@@ -89,6 +88,10 @@ into an object of the specified format.
88
cids := cid.NewSet()
89
b := ipld.NewBatch(req.Context, nd.DAG)
90
91
+ if dopin {
92
+ defer nd.Blockstore.PinLock().Unlock()
93
+ }
94
+
95
for {
96
file, err := req.Files.NextFile()
97
if err == io.EOF {
@@ -125,8 +128,6 @@ into an object of the specified format.
128
}
129
130
if dopin {
128
- defer nd.Blockstore.PinLock().Unlock()
129
-
131
cids.ForEach(func(c cid.Cid) error {
132
nd.Pinning.PinWithMode(c, pin.Recursive)
133
return nil