check: make the error count match up in the log message
Before this change we counted the final summary error as an error, producing confusing log messages like: Failed to check with 54 errors: last error was: 53 differences found This change marks the summary error as already being counted, so the error message becomes: Failed to check with 53 errors: last error was: 53 differences found This change also returns a listing failure in preference to a summary error. See: https://forum.rclone.org/t/slow-checksum-validation/19763/22
This commit is contained in:
parent
dc4e63631f
commit
4e2b5389d7
1 changed files with 10 additions and 3 deletions
|
@ -11,6 +11,7 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/fs/accounting"
|
||||
"github.com/rclone/rclone/fs/fserrors"
|
||||
"github.com/rclone/rclone/fs/hash"
|
||||
"github.com/rclone/rclone/fs/march"
|
||||
"github.com/rclone/rclone/lib/readers"
|
||||
|
@ -238,10 +239,16 @@ func CheckFn(ctx context.Context, opt *CheckOpt) error {
|
|||
if c.matches > 0 {
|
||||
fs.Logf(c.opt.Fdst, "%d matching files", c.matches)
|
||||
}
|
||||
if c.differences > 0 {
|
||||
return errors.Errorf("%d differences found", c.differences)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return err
|
||||
if c.differences > 0 {
|
||||
// Return an already counted error so we don't double count this error too
|
||||
err = fserrors.FsError(errors.Errorf("%d differences found", c.differences))
|
||||
fserrors.Count(err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Check the files in fsrc and fdst according to Size and hash
|
||||
|
|
Loading…
Reference in a new issue