From 1cedf057e634e8ea18704f5d6d1ed15aa53b9442 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Sun, 13 Nov 2022 14:36:23 -0700 Subject: [PATCH] Fix crash --- frigate/stats.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 = []