From 41f301a3fd825b833205392b1970e01f3520a2ca Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Mon, 22 Jul 2019 16:43:58 -0700 Subject: [PATCH] fix: parallel walk in gc & pin ls --- core/commands/pin.go | 2 +- core/coreapi/pin.go | 2 +- pin/gc/gc.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/commands/pin.go b/core/commands/pin.go index cd957fc5557..9392e7b9081 100644 --- a/core/commands/pin.go +++ b/core/commands/pin.go @@ -503,7 +503,7 @@ func pinLsAll(req *cmds.Request, typeStr string, n *core.IpfsNode, emit func(val if typeStr == "indirect" || typeStr == "all" { for _, k := range n.Pinning.RecursiveKeys() { var visitErr error - err := dag.WalkDepth(req.Context, dag.GetLinksWithDAG(n.DAG), k, 0, func(c cid.Cid, depth int) bool { + err := dag.WalkParallelDepth(req.Context, dag.GetLinksWithDAG(n.DAG), k, 0, func(c cid.Cid, depth int) bool { if depth == 0 { // skip it without visiting it. return true diff --git a/core/coreapi/pin.go b/core/coreapi/pin.go index 7cacfe29bad..7955ff0812a 100644 --- a/core/coreapi/pin.go +++ b/core/coreapi/pin.go @@ -209,7 +209,7 @@ func (api *PinAPI) pinLsAll(typeStr string, ctx context.Context) ([]coreiface.Pi if typeStr == "indirect" || typeStr == "all" { set := cid.NewSet() for _, k := range api.pinning.RecursiveKeys() { - err := merkledag.WalkDepth( + err := merkledag.WalkParallelDepth( ctx, merkledag.GetLinksWithDAG(api.dag), k, 0, func(c cid.Cid, depth int) bool { // don't visit the root node, that doesn't count. diff --git a/pin/gc/gc.go b/pin/gc/gc.go index 7190b1e0158..ad3c4149d39 100644 --- a/pin/gc/gc.go +++ b/pin/gc/gc.go @@ -171,7 +171,7 @@ func Descendants(ctx context.Context, getLinks dag.GetLinks, set *cid.Set, roots for _, c := range roots { // Walk recursively walks the dag and adds the keys to the given set - err := dag.Walk(ctx, verifyGetLinks, c, set.Visit) + err := dag.WalkParallel(ctx, verifyGetLinks, c, set.Visit) if err != nil { err = verboseCidError(err)