Skip to content

Commit

Permalink
fix: parallel walk in gc & pin ls
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Jul 22, 2019
1 parent 876d5ba commit 41f301a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/commands/pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/coreapi/pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pin/gc/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 41f301a

Please sign in to comment.