diff --git a/frigate/stats.py b/frigate/stats.py index 14bf8b471..9fd00cce8 100644 --- a/frigate/stats.py +++ b/frigate/stats.py @@ -89,8 +89,10 @@ def get_processing_stats(config: FrigateConfig, stats: dict[str, str]) -> None: async def run_tasks() -> None: await asyncio.wait( - asyncio.create_task(set_gpu_stats(config, stats)), - asyncio.create_task(set_cpu_stats(stats)), + [ + asyncio.create_task(set_gpu_stats(config, stats)), + asyncio.create_task(set_cpu_stats(stats)), + ] ) loop = asyncio.new_event_loop() @@ -99,7 +101,7 @@ def get_processing_stats(config: FrigateConfig, stats: dict[str, str]) -> None: loop.close() -def set_cpu_stats(all_stats: dict[str, str]) -> None: +async def set_cpu_stats(all_stats: dict[str, str]) -> None: """Set cpu usage from top.""" cpu_stats = get_cpu_stats() @@ -107,7 +109,7 @@ def set_cpu_stats(all_stats: dict[str, str]) -> None: all_stats["cpu_usages"] = cpu_stats -def set_gpu_stats(config: FrigateConfig, all_stats: dict[str, str]) -> None: +async def set_gpu_stats(config: FrigateConfig, all_stats: dict[str, str]) -> None: """Parse GPUs from hwaccel args and use for stats.""" hwaccel_args = []