mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 16:34:30 +01:00
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/
This commit is contained in:
parent
47b04580db
commit
653bc23728
@ -11,6 +11,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/rclone/rclone/fs"
|
"github.com/rclone/rclone/fs"
|
||||||
|
"github.com/rclone/rclone/fs/accounting"
|
||||||
"github.com/rclone/rclone/fs/config"
|
"github.com/rclone/rclone/fs/config"
|
||||||
"github.com/rclone/rclone/fs/hash"
|
"github.com/rclone/rclone/fs/hash"
|
||||||
"github.com/rclone/rclone/fs/walk"
|
"github.com/rclone/rclone/fs/walk"
|
||||||
@ -285,6 +286,8 @@ func dedupeFindDuplicateDirs(ctx context.Context, f fs.Fs) (duplicateDirs [][]*d
|
|||||||
ci := fs.GetConfig(ctx)
|
ci := fs.GetConfig(ctx)
|
||||||
err = walk.ListR(ctx, f, "", true, ci.MaxDepth, walk.ListAll, func(entries fs.DirEntries) error {
|
err = walk.ListR(ctx, f, "", true, ci.MaxDepth, walk.ListAll, func(entries fs.DirEntries) error {
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
|
tr := accounting.Stats(ctx).NewCheckingTransfer(entry)
|
||||||
|
|
||||||
remote := entry.Remote()
|
remote := entry.Remote()
|
||||||
parentRemote := path.Dir(remote)
|
parentRemote := path.Dir(remote)
|
||||||
if parentRemote == "." {
|
if parentRemote == "." {
|
||||||
@ -318,6 +321,7 @@ func dedupeFindDuplicateDirs(ctx context.Context, f fs.Fs) (duplicateDirs [][]*d
|
|||||||
}
|
}
|
||||||
|
|
||||||
dirsByID.increment(parent)
|
dirsByID.increment(parent)
|
||||||
|
tr.Done(ctx, nil)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
@ -434,6 +438,9 @@ func Deduplicate(ctx context.Context, f fs.Fs, mode DeduplicateMode, byHash bool
|
|||||||
files := map[string][]fs.Object{}
|
files := map[string][]fs.Object{}
|
||||||
err := walk.ListR(ctx, f, "", true, ci.MaxDepth, walk.ListObjects, func(entries fs.DirEntries) error {
|
err := walk.ListR(ctx, f, "", true, ci.MaxDepth, walk.ListObjects, func(entries fs.DirEntries) error {
|
||||||
entries.ForObject(func(o fs.Object) {
|
entries.ForObject(func(o fs.Object) {
|
||||||
|
tr := accounting.Stats(ctx).NewCheckingTransfer(o)
|
||||||
|
defer tr.Done(ctx, nil)
|
||||||
|
|
||||||
var remote string
|
var remote string
|
||||||
var err error
|
var err error
|
||||||
if byHash {
|
if byHash {
|
||||||
|
Loading…
Reference in New Issue
Block a user