From 215ae17272371c458f604367771f7cc029bcc69f Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Mon, 25 Mar 2024 17:56:33 +0000 Subject: [PATCH] rc: fix stats groups being ignored in operations/check Before this change operations/check was using a background context for the checking which was causing the stats group to be ignored. This fixes the problem and also a similar problem in backend/command See: https://forum.rclone.org/t/operations-check-only-reports-to-global-stats-not-per-job-group/45254 --- fs/operations/rc.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/operations/rc.go b/fs/operations/rc.go index 1435e66de..4b01108d2 100644 --- a/fs/operations/rc.go +++ b/fs/operations/rc.go @@ -639,7 +639,7 @@ func rcBackend(ctx context.Context, in rc.Params) (out rc.Params, err error) { if err != nil { return nil, err } - result, err := doCommand(context.Background(), command, arg, opt) + result, err := doCommand(ctx, command, arg, opt) if err != nil { return nil, fmt.Errorf("command %q failed: %w", command, err) @@ -858,13 +858,13 @@ func rcCheck(ctx context.Context, in rc.Params) (out rc.Params, err error) { if checkFileHash != "" { out["hashType"] = checkFileHashType.String() - err = CheckSum(context.Background(), dstFs, checkFileFs, checkFileRemote, checkFileHashType, opt, download) + err = CheckSum(ctx, dstFs, checkFileFs, checkFileRemote, checkFileHashType, opt, download) } else { if download { - err = CheckDownload(context.Background(), opt) + err = CheckDownload(ctx, opt) } else { out["hashType"] = srcFs.Hashes().Overlap(dstFs.Hashes()).GetOne().String() - err = Check(context.Background(), opt) + err = Check(ctx, opt) } } if err != nil {