chore(release): 0.5.0 #13
@@ -293,6 +293,15 @@ class BackendServer:
|
||||
self._accept_connection(key.fileobj) # type: ignore
|
||||
else:
|
||||
self._handle_connection(key, mask)
|
||||
|
||||
# update client statuses
|
||||
now = time.time()
|
||||
for client in self.clients.values():
|
||||
if (
|
||||
client.status == ClientStatus.OFFLINE
|
||||
and now - client.last_seen > 60 * 60 * 24 # 24 hours
|
||||
):
|
||||
self.clients[client.id].status = ClientStatus.STALE
|
||||
time.sleep(0.001) # prevent 100% CPU usage
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user