mirror of
https://github.com/rclone/rclone.git
synced 2026-09-19 12:18:02 -04:00
The concurrent walker created by walk() only stopped when the callback returned an error or the whole tree had been listed. Cancelling the context (for example via the rc job/stop endpoint for an async operations/size or recursive operations/list call) was therefore ignored: the checkers kept pulling list jobs from the channel and kept listing the entire tree, burning CPU and making job cancellation useless for every backend without a native ListR implementation. Make every checker select on ctx.Done() so a cancelled walk shuts down promptly through the existing quit/drain path and reports the context error. Also check the context between directory read chunks in the local backend so a single huge directory does not block cancellation.