mux: improve process name cache and fg proc name on windows

Reduce the cache lifetime a bit, and resolve a potential
racy/non-deterministic result due to the timestamp granularity.
This commit is contained in:
Wez Furlong committed 2021-12-30 17:17:28 -07:00
1 parent 97c8cda974
commit e225589b05
2 files changed
+14 -3

No files matched your search

+13 -2
View File
@@ -361,8 +361,19 @@ impl Pane for LocalPane {
proc: &'a LocalProcessInfo,
youngest: &mut &'a LocalProcessInfo,
) {
if proc.start_time > youngest.start_time {
*youngest = proc;
if proc.start_time >= youngest.start_time {
// start_time has only 1 second granularity, and spawning
// a child process will typically spawn a console host at
// the same time.
// We might traverse one snapshot of the tree differently
// from another due to random seeds in the hash table,
// so we do a little bit of targeted workaround here
// to suppress the console hosts from candidate child
// processes.
let ignore = proc.name == "OpenConsole.exe" || proc.name == "conhost.exe";
if !ignore {
*youngest = proc;
}
}
for child in proc.children.values() {
+1 -1
View File
@@ -37,7 +37,7 @@ impl CachedSystemInfo {
}
pub fn check_refresh(&mut self) {
if self.last_update.elapsed() < Duration::from_millis(1000) {
if self.last_update.elapsed() < Duration::from_millis(300) {
return;
}
self.refresh_now();