Fix idle-timeout loop to avoid modifying the SESSIONS dict in-place. Resolves #1992

This commit is contained in:
Griatch 2020-01-20 19:37:09 +01:00
parent c428eb72a5
commit 6e561d95a1

View file

@ -148,12 +148,16 @@ def _server_maintenance():
# handle idle timeouts
if _IDLE_TIMEOUT > 0:
reason = _("idle timeout exceeded")
to_disconnect = []
for session in (
sess for sess in SESSIONS.values() if (now - sess.cmd_last) > _IDLE_TIMEOUT
):
if not session.account or not session.account.access(
session.account, "noidletimeout", default=False
):
to_disconnect.append(session)
for session in to_disconnect:
SESSIONS.disconnect(session, reason=reason)