summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBharath Vignesh J K <52282402+RazCrimson@users.noreply.github.com>2023-05-14 02:17:28 +0530
committerBharath Vignesh J K <52282402+RazCrimson@users.noreply.github.com>2023-05-14 02:21:18 +0530
commit83fc2a26a65e1360c9e7fcd2f50bd0a73c0d2f1f (patch)
tree14bc03aaae11900db17ad677fadc21a0106ff1f6
parentb1da4f6ff418643e43c659ca3d5eb3fc9e7d4ea1 (diff)
chg: containers (podman) - stats iteration interval longer
fix #2390 note: tmp fix Proper sol - https://github.com/containers/podman-py/pull/266
-rw-r--r--glances/plugins/containers/glances_podman.py2
-rw-r--r--glances/plugins/containers/stats_streamer.py6
2 files changed, 5 insertions, 3 deletions
diff --git a/glances/plugins/containers/glances_podman.py b/glances/plugins/containers/glances_podman.py
index f2038343..f2476754 100644
--- a/glances/plugins/containers/glances_podman.py
+++ b/glances/plugins/containers/glances_podman.py
@@ -91,7 +91,7 @@ class PodmanPodStatsFetcher:
# Threaded Streamer
# Temporary patch to get podman extension working
stats_iterable = (pod_manager.stats(decode=True) for _ in iter(int, 1))
- self._streamer = StatsStreamer(stats_iterable, initial_stream_value={})
+ self._streamer = StatsStreamer(stats_iterable, initial_stream_value={}, sleep_duration=2)
def _log_debug(self, msg, exception=None):
logger.debug("containers (Podman): Pod Manager - {} ({})".format(msg, exception))
diff --git a/glances/plugins/containers/stats_streamer.py b/glances/plugins/containers/stats_streamer.py
index 9218c483..7dc967fe 100644
--- a/glances/plugins/containers/stats_streamer.py
+++ b/glances/plugins/containers/stats_streamer.py
@@ -19,7 +19,7 @@ class StatsStreamer:
Use `StatsStreamer.stats` to access the latest streamed results
"""
- def __init__(self, iterable, initial_stream_value=None):
+ def __init__(self, iterable, initial_stream_value=None, sleep_duration=0.1):
"""
iterable: an Iterable instance that needs to be streamed
"""
@@ -34,6 +34,8 @@ class StatsStreamer:
self.result_lock = threading.Lock()
# Last result streamed time (initial val 0)
self._last_update_time = 0
+ # Time to sleep before next iteration
+ self._sleep_duration = sleep_duration
self._thread.start()
@@ -56,7 +58,7 @@ class StatsStreamer:
self._raw_result = res
self._post_update_hook()
- time.sleep(0.1)
+ time.sleep(self._sleep_duration)
if self.stopped():
break