diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-30 23:58:15 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-30 23:58:34 +0300 |
| commit | fc4e1bbf6b0fa2ec37445a5b72356514c7c6be6a (patch) | |
| tree | 93af04af44a4dcc062a7886c51d70641c1903144 /src/app/api.rs | |
| parent | d477341e6af816ff4396042b084a0378ef437b4a (diff) | |
perf: reduce sidebar git polling overhead
refs #353
Diffstat (limited to 'src/app/api.rs')
| -rw-r--r-- | src/app/api.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/app/api.rs b/src/app/api.rs index a26b2856..d8224506 100644 --- a/src/app/api.rs +++ b/src/app/api.rs @@ -21,14 +21,29 @@ enum RuntimeExitAction { impl App { pub(crate) fn handle_internal_event(&mut self, ev: AppEvent) { if let AppEvent::ClipboardWrite { content } = ev { + #[cfg(not(test))] crate::selection::write_osc52_bytes(&content); + #[cfg(test)] + let _ = content; self.show_clipboard_feedback(); return; } - if let AppEvent::GitStatusRefreshed { results } = ev { + if let AppEvent::GitStatusRefreshed { + results, + cache_updates, + } = ev + { self.git_refresh_in_flight = false; - self.last_git_remote_status_refresh = Instant::now(); + for (key, entry) in cache_updates { + self.git_status_cache.insert(key, entry); + } + if self.git_refresh_due_after_in_flight { + self.mark_git_status_refresh_due(Instant::now()); + self.git_refresh_due_after_in_flight = false; + } else { + self.last_git_remote_status_refresh = Instant::now(); + } if self .state .apply_workspace_git_statuses(&self.terminal_runtimes, results) |
