diff options
author | nicolargo <nicolashennion@gmail.com> | 2024-06-26 18:36:10 +0200 |
---|---|---|
committer | nicolargo <nicolashennion@gmail.com> | 2024-06-26 18:36:10 +0200 |
commit | cff2e9fc4a72948d96e604f97bf20e68185afa18 (patch) | |
tree | d2d5728c50cc5e8a5ab6318d142e501fd3838488 | |
parent | e5d5351d3164d7ef98638ebf8778cefba013bec2 (diff) |
Call process_iter.clear_cache() (PsUtil 6+) when Glances user force a refresh (F5 or CTRL-R) #2753
-rw-r--r-- | glances/outputs/glances_curses.py | 2 | ||||
-rw-r--r-- | glances/processes.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index 9280c54d..1db8d752 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -370,7 +370,7 @@ class _GlancesCurses: logger.info(f"Stop Glances (keypressed: {self.pressedkey})") def _handle_refresh(self): - pass + glances_processes.reset_internal_cache() def loop_position(self): """Return the current sort in the loop""" diff --git a/glances/processes.py b/glances/processes.py index 0b507596..a01cd929 100644 --- a/glances/processes.py +++ b/glances/processes.py @@ -119,6 +119,12 @@ class GlancesProcesses: """Set args.""" self.args = args + def reset_internal_cache(self): + """Reset the internal cache.""" + self.cache_timer = Timer(0) + self.processlist_cache = {} + psutil.process_iter.cache_clear() + def reset_processcount(self): """Reset the global process count""" self.processcount = {'total': 0, 'running': 0, 'sleeping': 0, 'thread': 0, 'pid_max': None} |