mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Merge branch 'dev' of gitlab.com:crafty-controller/crafty-4 into dev
This commit is contained in:
commit
53c622e928
@ -130,16 +130,19 @@ class Stats:
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def _try_get_process_stats(process):
|
||||
try:
|
||||
return Stats._get_process_stats(process)
|
||||
except Exception as e:
|
||||
logger.debug(
|
||||
f"getting process stats for pid {process.pid} "
|
||||
"failed due to the following error:",
|
||||
exc_info=e,
|
||||
)
|
||||
return {"cpu_usage": -1, "memory_usage": -1, "mem_percentage": -1}
|
||||
def _try_get_process_stats(process, running):
|
||||
if running:
|
||||
try:
|
||||
return Stats._get_process_stats(process)
|
||||
except Exception as e:
|
||||
logger.debug(
|
||||
f"getting process stats for pid {process.pid} "
|
||||
"failed due to the following error:",
|
||||
exc_info=e,
|
||||
)
|
||||
return {"cpu_usage": -1, "memory_usage": -1, "mem_percentage": -1}
|
||||
else:
|
||||
return {"cpu_usage": 0, "memory_usage": 0, "mem_percentage": 0}
|
||||
|
||||
@staticmethod
|
||||
def _get_process_stats(process):
|
||||
|
@ -1255,7 +1255,7 @@ class ServerInstance:
|
||||
server_path = server["path"]
|
||||
|
||||
# process stats
|
||||
p_stats = Stats._try_get_process_stats(self.process)
|
||||
p_stats = Stats._try_get_process_stats(self.process, self.check_running())
|
||||
|
||||
# TODO: search server properties file for possible override of 127.0.0.1
|
||||
internal_ip = server["server_ip"]
|
||||
@ -1388,7 +1388,7 @@ class ServerInstance:
|
||||
server_path = server_dt["path"]
|
||||
|
||||
# process stats
|
||||
p_stats = Stats._try_get_process_stats(self.process)
|
||||
p_stats = Stats._try_get_process_stats(self.process, self.check_running())
|
||||
|
||||
# TODO: search server properties file for possible override of 127.0.0.1
|
||||
# internal_ip = server['server_ip']
|
||||
|
Loading…
Reference in New Issue
Block a user