From a5eff1213137b767ba2fc053a714c47390ff28ec Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Fri, 4 Feb 2022 19:14:04 -0500 Subject: [PATCH] proc_stats: start timers in component init Avoid adding event loop callbacks in a component's "__init__()" method. Signed-off-by: Eric Callahan --- moonraker/components/proc_stats.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/moonraker/components/proc_stats.py b/moonraker/components/proc_stats.py index 2284d4f..b7bed48 100644 --- a/moonraker/components/proc_stats.py +++ b/moonraker/components/proc_stats.py @@ -91,6 +91,8 @@ class ProcStats: self.last_cpu_stats: Dict[str, Tuple[int, int]] = {} self.cpu_usage: Dict[str, float] = {} self.stat_callbacks: List[STAT_CALLBACK] = [] + + async def component_init(self) -> None: self.stat_update_timer.start() self.watchdog.start()