cubicweb #5757240 AbstractSessionManager.clean_sessions is buggy [validation pending]

changeset 0c678b63d017 not only moved the code of AbstractSessionManager from web/application.py to web/views/sessions.py, it also modified the code of the clean_sessions method into:

for session in self.current_sessions():
    total += 1
    try:
        last_usage_time = session.cnx.check()
    except AttributeError:
        last_usage_time = session.mtime
    except BadConnectionId:
        self.close_session(session)
        closed += 1
    else:
        no_use_time = (time() - last_usage_time)
        if session.anonymous_session:
            if no_use_time >= self.cleanup_anon_session_time:
                self.close_session(session)
                closed += 1
        elif session_time is not None and no_use_time >= session_time:
            self.close_session(session)
            closed += 1

so each time "session.cnx.check()" will raise an AtrributeError, the session will NOT be cleaned.

prioritynormal
typebug
done in3.21.1
load0.500
load left0.000
closed by#9826dc78eec1 [web] fix AbstractSessionManager.clean_sessions (closes #5757240)
patch[web] fix AbstractSessionManager.clean_sessions (closes #5757240) [applied]