try to check_alive

This commit is contained in:
Maxim Khomutov 2023-07-18 22:33:15 +03:00
parent 45d45a820c
commit 31d8cf7842

View File

@ -95,16 +95,20 @@ class Core:
async def check_alive(self): async def check_alive(self):
maxp = config.Game['players'] maxp = config.Game['players']
while self.run: try:
await asyncio.sleep(1) while self.run:
ca = f"Ss{len(self.clients_by_id)}/{maxp}:{self.get_clients_list()}" await asyncio.sleep(1)
for client in self.clients: ca = f"Ss{len(self.clients_by_id)}/{maxp}:{self.get_clients_list()}"
if not client: for client in self.clients:
continue if not client:
if not client.ready: continue
client.is_disconnected() if not client.ready:
continue client.is_disconnected()
await client._send(bytes(ca, "utf-8")) continue
await client._send(bytes(ca, "utf-8"))
except Exception as e:
self.log.error("Error in check_alive.")
self.log.exception(e)
@staticmethod @staticmethod
def start_web(): def start_web():