Fix crash

This commit is contained in:
Nick Mowen 2022-11-13 14:36:23 -07:00
parent 65e8b32ce9
commit 1cedf057e6

View File

@ -89,8 +89,10 @@ def get_processing_stats(config: FrigateConfig, stats: dict[str, str]) -> None:
async def run_tasks() -> None: async def run_tasks() -> None:
await asyncio.wait( 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() loop = asyncio.new_event_loop()
@ -99,7 +101,7 @@ def get_processing_stats(config: FrigateConfig, stats: dict[str, str]) -> None:
loop.close() 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.""" """Set cpu usage from top."""
cpu_stats = get_cpu_stats() 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 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.""" """Parse GPUs from hwaccel args and use for stats."""
hwaccel_args = [] hwaccel_args = []