Check for None when getting the CPU frequency data

Default to -1 when an error occurs
This commit is contained in:
luukas 2022-07-06 19:00:17 +03:00
parent 43a93f35b3
commit 4f7e1bfa24
No known key found for this signature in database
GPG Key ID: CC4915E8D71FC044

View File

@ -87,7 +87,9 @@ class Stats:
try:
cpu_freq = psutil.cpu_freq()
except NotImplementedError:
cpu_freq = psutil._common.scpufreq(current=0, min=0, max=0)
cpu_freq = None
if cpu_freq is None:
cpu_freq = psutil._common.scpufreq(current=-1, min=-1, max=-1)
memory = psutil.virtual_memory()
try:
node_stats: NodeStatsDict = {