mirror of
https://github.com/rclone/rclone.git
synced 2026-09-13 14:49:29 -04:00
Before this change, `fastCopy` created a cancellable context for the sync and stored its cancel func on the `bisyncRun`, but only ever called it when gracefully shutting down. On a normal run, it was never called, and until it is cancelled, a context from `context.WithCancel` stays registered with its nearest cancellable ancestor. For an rc job, that ancestor is the job's own context, which the job registry retains for `--rc-job-expire-duration`. The sync context carries bisync's `LoggerOpt`, whose `LoggerFn` is a method value on `*bisyncRun`, so a finished run was kept alive -- including the Path1 and Path2 listings -- for as long as the job was. This change fixes the issue by cancelling the sync context when `fastCopy` returns. The cancel func is still stored on the `bisyncRun`, so a graceful shutdown can still interrupt a sync that is in progress.