mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
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,13 +148,17 @@ 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
|
||||
):
|
||||
SESSIONS.disconnect(session, reason=reason)
|
||||
to_disconnect.append(session)
|
||||
|
||||
for session in to_disconnect:
|
||||
SESSIONS.disconnect(session, reason=reason)
|
||||
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue