Catch division by zero

This commit is contained in:
Nicolas Mowen 2024-10-21 08:22:32 -06:00
parent 4a35b52bef
commit f6328c6362

View File

@ -282,7 +282,7 @@ def get_intel_gpu_stats() -> dict[str, str]:
try: try:
data = json.loads(f'[{"".join(p.stdout.split())}]') data = json.loads(f'[{"".join(p.stdout.split())}]')
except json.JSONDecodeError: except json.JSONDecodeError:
return None return {"gpu": "-%", "mem": "-%"}
results: dict[str, str] = {} results: dict[str, str] = {}
render = {"global": []} render = {"global": []}
@ -332,7 +332,7 @@ def get_intel_gpu_stats() -> dict[str, str]:
results["clients"] = {} results["clients"] = {}
for key in render.keys(): for key in render.keys():
if key == "global": if key == "global" or not render[key] or not video[key]:
continue continue
results["clients"][key] = ( results["clients"][key] = (