mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-04 00:47:00 +01:00
fix(fuse,core,gui): routine mirror scans no longer show as syncing
Every mirror pass, the two-minute poll included, reported a "Checking
{folder}" job, and the tray took any job for syncing, so its icon spun
every two minutes over folders with nothing to do.
JobItem gains a background flag (absent from older daemons, so false)
for housekeeping that changes nothing in the user's files: a pass still
scanning, the home index rebuild and the cache integrity check. The tray
keeps them in its menu line but only turns busy for transfers or a job
that is not background; a pass that queues work becomes a Syncing job
and still spins the icon.
The watcher also reconciles only the folder an event lies in, instead of
walking every mirror folder over one edit.
This commit is contained in:
1 parent
922399b9a2
commit
7ebe8e5210
8 files changed
+147
-24
No files matched your search
@@ -50,7 +50,7 @@ mod planner;
|
||||
use engine::SYNC_CONCURRENCY;
|
||||
pub(crate) use engine::{SyncMsg, spawn};
|
||||
#[cfg(test)]
|
||||
use engine::{classify, settle_with};
|
||||
use engine::{classify, event_target, settle_with};
|
||||
#[cfg(test)]
|
||||
use local_scan::is_write_mode;
|
||||
use local_scan::open_for_write_set;
|
||||
@@ -2097,6 +2097,32 @@ mod tests {
|
||||
(ids, started.elapsed())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_change_in_one_mirror_folder_reconciles_only_that_folder() {
|
||||
let watched = vec![
|
||||
(PathBuf::from("/home/me/Docs"), 1),
|
||||
(PathBuf::from("/home/me/Photos"), 2),
|
||||
(PathBuf::from("/home/me/Photos/Raw"), 3),
|
||||
];
|
||||
let target = |paths: &[&str]| {
|
||||
let paths: Vec<PathBuf> = paths.iter().map(PathBuf::from).collect();
|
||||
match event_target(&watched, &paths) {
|
||||
SyncMsg::Reconcile(id) => Some(id),
|
||||
SyncMsg::ReconcileAll => None,
|
||||
_ => panic!("unexpected message"),
|
||||
}
|
||||
};
|
||||
assert_eq!(target(&["/home/me/Docs/a.txt"]), Some(1));
|
||||
// A rename within one folder.
|
||||
assert_eq!(target(&["/home/me/Docs/a", "/home/me/Docs/b"]), Some(1));
|
||||
// The deepest root wins.
|
||||
assert_eq!(target(&["/home/me/Photos/Raw/x.cr2"]), Some(3));
|
||||
// Across folders, outside them all, or no path at all: walk everything.
|
||||
assert_eq!(target(&["/home/me/Docs/a", "/home/me/Photos/a"]), None);
|
||||
assert_eq!(target(&["/home/me/Docsx/a"]), None);
|
||||
assert_eq!(target(&[]), None);
|
||||
}
|
||||
|
||||
/// The bug this replaced a fixed sleep for: a save that keeps writing past
|
||||
/// the debounce used to be walked mid-write, uploading a torn snapshot as a
|
||||
/// real revision. The window has to restart on every event, so settling
|
||||
|
||||
Reference in new issue
Block a user