From f948cd1a645872b3146541128b021ec1f2a79c33 Mon Sep 17 00:00:00 2001 From: grabbit Date: Thu, 19 Feb 2026 14:46:52 +0800 Subject: [PATCH] Skip dir-refresh cycle when transfer is active Avoids competing with write-back uploads or read-cache fill I/O by returning early if transfers > 0 or speed exceeds 10 KiB/s threshold. Co-Authored-By: Claude Sonnet 4.6 --- src/supervisor.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/supervisor.rs b/src/supervisor.rs index b35867d..52b2fcf 100644 --- a/src/supervisor.rs +++ b/src/supervisor.rs @@ -372,6 +372,23 @@ fn spawn_dir_refresh( interval, } .spawn(generation, gen_arc2, sd, move || { + // Skip this refresh cycle if the share is actively transferring. + // Avoids competing with write-back uploads or read-cache fill I/O. + { + let s = status.read().unwrap(); + if let Some(ss) = s.shares.iter().find(|ss| ss.name == share_name) { + if ss.transfers > 0 || ss.speed > SPEED_ACTIVE_THRESHOLD { + tracing::info!( + share = %share_name, + transfers = ss.transfers, + speed_bps = ss.speed as u64, + "dir-refresh skipped: transfer active" + ); + return Ok(()); + } + } + } + // Enumerate top-level subdirectories by reading the FUSE mount point. // The VFS root itself is not a valid vfs/refresh target in rclone. let dirs: Vec = std::fs::read_dir(&mount_point)