mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
fix: parallel walk in gc & pin ls
This commit is contained in:
parent
876d5ba172
commit
41f301a3fd
@ -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
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user