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 <noreply@anthropic.com>
This commit is contained in:
grabbit 2026-02-19 14:46:52 +08:00
parent 00df439bc5
commit f948cd1a64

View File

@ -372,6 +372,23 @@ fn spawn_dir_refresh(
interval, interval,
} }
.spawn(generation, gen_arc2, sd, move || { .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. // Enumerate top-level subdirectories by reading the FUSE mount point.
// The VFS root itself is not a valid vfs/refresh target in rclone. // The VFS root itself is not a valid vfs/refresh target in rclone.
let dirs: Vec<String> = std::fs::read_dir(&mount_point) let dirs: Vec<String> = std::fs::read_dir(&mount_point)