Fix idle-timeout loop to avoid modifying the SESSIONS dict in-place. Resolves #1992
This commit is contained in:
parent
c428eb72a5
commit
6e561d95a1
1 changed files with 5 additions and 1 deletions
|
|
@ -148,12 +148,16 @@ def _server_maintenance():
|
||||||
# handle idle timeouts
|
# handle idle timeouts
|
||||||
if _IDLE_TIMEOUT > 0:
|
if _IDLE_TIMEOUT > 0:
|
||||||
reason = _("idle timeout exceeded")
|
reason = _("idle timeout exceeded")
|
||||||
|
to_disconnect = []
|
||||||
for session in (
|
for session in (
|
||||||
sess for sess in SESSIONS.values() if (now - sess.cmd_last) > _IDLE_TIMEOUT
|
sess for sess in SESSIONS.values() if (now - sess.cmd_last) > _IDLE_TIMEOUT
|
||||||
):
|
):
|
||||||
if not session.account or not session.account.access(
|
if not session.account or not session.account.access(
|
||||||
session.account, "noidletimeout", default=False
|
session.account, "noidletimeout", default=False
|
||||||
):
|
):
|
||||||
|
to_disconnect.append(session)
|
||||||
|
|
||||||
|
for session in to_disconnect:
|
||||||
SESSIONS.disconnect(session, reason=reason)
|
SESSIONS.disconnect(session, reason=reason)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue