aboutsummaryrefslogtreecommitdiff
path: root/src/app/mod.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-30 23:58:15 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-30 23:58:34 +0300
commitfc4e1bbf6b0fa2ec37445a5b72356514c7c6be6a (patch)
tree93af04af44a4dcc062a7886c51d70641c1903144 /src/app/mod.rs
parentd477341e6af816ff4396042b084a0378ef437b4a (diff)
perf: reduce sidebar git polling overhead
refs #353
Diffstat (limited to 'src/app/mod.rs')
-rw-r--r--src/app/mod.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/app/mod.rs b/src/app/mod.rs
index d8071c4d..273016db 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -97,6 +97,8 @@ pub struct App {
pub(crate) copy_feedback_deadline: Option<Instant>,
pub(crate) last_git_remote_status_refresh: Instant,
pub(crate) git_refresh_in_flight: bool,
+ pub(crate) git_refresh_due_after_in_flight: bool,
+ pub(crate) git_status_cache: HashMap<std::path::PathBuf, crate::workspace::GitStatusCacheEntry>,
pub(crate) last_sidebar_divider_click: Option<Instant>,
pub(crate) last_pane_click: Option<PaneClickState>,
pub(crate) next_resize_poll: Instant,
@@ -563,6 +565,8 @@ impl App {
event_rx,
last_git_remote_status_refresh: Instant::now() - GIT_REMOTE_STATUS_REFRESH_INTERVAL,
git_refresh_in_flight: false,
+ git_refresh_due_after_in_flight: false,
+ git_status_cache: HashMap::new(),
last_sidebar_divider_click: None,
last_pane_click: None,
next_resize_poll: Instant::now() + RESIZE_POLL_INTERVAL,
@@ -1459,6 +1463,7 @@ mod tests {
app.handle_internal_event(AppEvent::GitStatusRefreshed {
results: Vec::new(),
+ cache_updates: Vec::new(),
});
assert!(!app.git_refresh_in_flight);
@@ -1481,6 +1486,7 @@ mod tests {
ahead_behind: Some((1, 0)),
space: None,
}],
+ cache_updates: Vec::new(),
});
assert!(app.render_dirty.load(Ordering::Acquire));
@@ -2915,7 +2921,7 @@ mod tests {
app.next_auto_update_check = Some(now + Duration::from_secs(6));
assert_eq!(
- app.next_headless_loop_deadline(now, false),
+ app.next_headless_loop_deadline_with_git_refresh(now, false, true),
app.session_save_deadline
);
}
@@ -2932,7 +2938,10 @@ mod tests {
app.session_save_deadline = None;
app.state.workspaces.clear();
- assert_eq!(app.next_headless_loop_deadline(now, false), None);
+ assert_eq!(
+ app.next_headless_loop_deadline_with_git_refresh(now, false, true),
+ None
+ );
}
#[test]