proc_stats: start timers in component init

Avoid adding  event loop callbacks in a component's "__init__()" method.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-02-04 19:14:04 -05:00
parent 0f7af929f1
commit a5eff12131
1 changed files with 2 additions and 0 deletions

View File

@ -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()