trying to reproduce failure

pull/279/head
Andrew Mirsky 2025-07-26 18:19:43 -04:00
rodzic 81beb7ebed
commit b291ff49db
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: A98E67635CDF2C39
1 zmienionych plików z 4 dodań i 0 usunięć

Wyświetl plik

@ -307,6 +307,7 @@ class Broker:
while True:
session_count_before = len(self._sessions)
self.logger.warning("evaluating session expiration")
# clean or anonymous sessions don't retain messages (or subscriptions); the session can be filtered out
sessions_to_remove = [ client_id for client_id, (session, _) in self._sessions.items()
@ -314,13 +315,16 @@ class Broker:
# if session expiration is enabled, check to see if any of the sessions are disconnected and past expiration
if self.config.session_expiry_interval is not None:
self.logger.warning(f"sessions expiring due to time. before: {session_count_before}")
retain_after = floor(time.time() - self.config.session_expiry_interval)
sessions_to_remove += [ client_id for client_id, (session, _) in self._sessions.items()
if session.transitions.state == "disconnected" and
session.last_disconnect_time and
session.last_disconnect_time < retain_after ]
self.logger.warning(f"need to remove these sessions: {sessions_to_remove}")
for client_id in sessions_to_remove:
self.logger.warning(f"removing session: {client_id}")
await self._cleanup_session(client_id)
if session_count_before > (session_count_after := len(self._sessions)):