Esempio n. 1
0
def _portal_maintenance():
    """
    The maintenance function handles repeated checks and updates that
    the server needs to do. It is called every minute.

    """
    # check for idle sessions
    now = time.time()

    reason = "Idle timeout exceeded, disconnecting."
    for session in [sess for sess in PORTAL_SESSIONS.values() if (now - sess.cmd_last) > _IDLE_TIMEOUT]:
        session.data_out(text=[[reason], {}])
        PORTAL_SESSIONS.disconnect(session)
Esempio n. 2
0
def _portal_maintenance():
    """
    The maintenance function handles repeated checks and updates that
    the server needs to do. It is called every minute.

    """
    # check for idle sessions
    now = time.time()

    reason = "Idle timeout exceeded, disconnecting."
    for session in [sess for sess in PORTAL_SESSIONS.values()
                    if (now - sess.cmd_last) > _IDLE_TIMEOUT]:
        session.disconnect(reason=reason)
        PORTAL_SESSIONS.disconnect(session)