From 653bc2372845b58865c25c76ade835a51e1c1084 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 8 Nov 2022 20:19:28 +0000 Subject: [PATCH] dedupe: count Checks in the stats while scanning for duplicates This allows the user to see rclone has not hung. See: https://forum.rclone.org/t/dial-tcp-lookup-api-pcloud-com-no-such-host/33910/ --- fs/operations/dedupe.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/operations/dedupe.go b/fs/operations/dedupe.go index 32daa9d4d..ca4376a29 100644 --- a/fs/operations/dedupe.go +++ b/fs/operations/dedupe.go @@ -11,6 +11,7 @@ import ( "strings" "github.com/rclone/rclone/fs" + "github.com/rclone/rclone/fs/accounting" "github.com/rclone/rclone/fs/config" "github.com/rclone/rclone/fs/hash" "github.com/rclone/rclone/fs/walk" @@ -285,6 +286,8 @@ func dedupeFindDuplicateDirs(ctx context.Context, f fs.Fs) (duplicateDirs [][]*d ci := fs.GetConfig(ctx) err = walk.ListR(ctx, f, "", true, ci.MaxDepth, walk.ListAll, func(entries fs.DirEntries) error { for _, entry := range entries { + tr := accounting.Stats(ctx).NewCheckingTransfer(entry) + remote := entry.Remote() parentRemote := path.Dir(remote) if parentRemote == "." { @@ -318,6 +321,7 @@ func dedupeFindDuplicateDirs(ctx context.Context, f fs.Fs) (duplicateDirs [][]*d } dirsByID.increment(parent) + tr.Done(ctx, nil) } return nil }) @@ -434,6 +438,9 @@ func Deduplicate(ctx context.Context, f fs.Fs, mode DeduplicateMode, byHash bool files := map[string][]fs.Object{} err := walk.ListR(ctx, f, "", true, ci.MaxDepth, walk.ListObjects, func(entries fs.DirEntries) error { entries.ForObject(func(o fs.Object) { + tr := accounting.Stats(ctx).NewCheckingTransfer(o) + defer tr.Done(ctx, nil) + var remote string var err error if byHash {