Merge pull request #71 from ipfs/pin-ls-recursive
Use "pin ls --type=recursive $pin" when checking if a pin exists
This commit is contained in:
commit
98043ca675
|
@ -431,10 +431,10 @@ func (ipfs *Connector) PinLs(typeFilter string) (map[string]api.IPFSPinStatus, e
|
|||
return statusMap, nil
|
||||
}
|
||||
|
||||
// PinLsCid performs a "pin ls <hash> "request and returns IPFSPinStatus for
|
||||
// that hash.
|
||||
// PinLsCid performs a "pin ls --type=recursive <hash> "request and returns
|
||||
// an api.IPFSPinStatus for that hash.
|
||||
func (ipfs *Connector) PinLsCid(hash *cid.Cid) (api.IPFSPinStatus, error) {
|
||||
lsPath := fmt.Sprintf("pin/ls?arg=%s", hash)
|
||||
lsPath := fmt.Sprintf("pin/ls?arg=%s&type=recursive", hash)
|
||||
body, err := ipfs.get(lsPath)
|
||||
|
||||
// Network error, daemon down
|
||||
|
|
|
@ -224,6 +224,7 @@ func (mpt *MapPinTracker) pin(c api.Pin) error {
|
|||
|
||||
func (mpt *MapPinTracker) unpin(c api.Pin) error {
|
||||
logger.Debugf("issuing unpin call for %s", c.Cid)
|
||||
mpt.set(c.Cid, api.TrackerStatusUnpinning)
|
||||
err := mpt.rpcClient.Call("",
|
||||
"Cluster",
|
||||
"IPFSUnpin",
|
||||
|
|
|
@ -108,6 +108,8 @@ func TestUntrack(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
time.Sleep(time.Second / 2)
|
||||
|
||||
err = mpt.Untrack(h2)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -121,7 +123,7 @@ func TestUntrack(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
time.Sleep(400 * time.Millisecond)
|
||||
time.Sleep(time.Second / 2)
|
||||
|
||||
st := mpt.Status(h1)
|
||||
if st.Status != api.TrackerStatusUnpinned {
|
||||
|
|
Loading…
Reference in New Issue
Block a user