@cryptotaxi247 / kubo / commits / 41f301a3f

fix: parallel walk in gc & pin ls

Steven Allen committed Jul 22, 2019 at 16:43 UTC 41f301a3fd825b833205392b1970e01f3520a2ca
3 files changed +3 -3
core/commands/pin.go
+1 -1
@@ -503,7 +503,7 @@ func pinLsAll(req *cmds.Request, typeStr string, n *core.IpfsNode, emit func(val
503 if typeStr == "indirect" || typeStr == "all" {
504 for _, k := range n.Pinning.RecursiveKeys() {
505 var visitErr error
506 - err := dag.WalkDepth(req.Context, dag.GetLinksWithDAG(n.DAG), k, 0, func(c cid.Cid, depth int) bool {
506 + err := dag.WalkParallelDepth(req.Context, dag.GetLinksWithDAG(n.DAG), k, 0, func(c cid.Cid, depth int) bool {
507 if depth == 0 {
508 // skip it without visiting it.
509 return true
core/coreapi/pin.go
+1 -1
@@ -209,7 +209,7 @@ func (api *PinAPI) pinLsAll(typeStr string, ctx context.Context) ([]coreiface.Pi
209 if typeStr == "indirect" || typeStr == "all" {
210 set := cid.NewSet()
211 for _, k := range api.pinning.RecursiveKeys() {
212 - err := merkledag.WalkDepth(
212 + err := merkledag.WalkParallelDepth(
213 ctx, merkledag.GetLinksWithDAG(api.dag), k, 0,
214 func(c cid.Cid, depth int) bool {
215 // don't visit the root node, that doesn't count.
pin/gc/gc.go
+1 -1
@@ -171,7 +171,7 @@ func Descendants(ctx context.Context, getLinks dag.GetLinks, set *cid.Set, roots
171
172 for _, c := range roots {
173 // Walk recursively walks the dag and adds the keys to the given set
174 - err := dag.Walk(ctx, verifyGetLinks, c, set.Visit)
174 + err := dag.WalkParallel(ctx, verifyGetLinks, c, set.Visit)
175
176 if err != nil {
177 err = verboseCidError(err)