[web] fix AbstractSessionManager.clean_sessions (closes #5757240)
authorDavid Douard <david.douard@logilab.fr>
Tue, 28 Jul 2015 11:21:36 +0200
changeset 10557 9826dc78eec1
parent 10556 8fbff2247816
child 10558 5583bebe9e7f
[web] fix AbstractSessionManager.clean_sessions (closes #5757240) sessions were not closed if "last_usage_time = session.cnx.check()" actually raises an AtributeError.
web/views/sessions.py
--- a/web/views/sessions.py	Tue Jul 21 14:29:42 2015 +0200
+++ b/web/views/sessions.py	Tue Jul 28 11:21:36 2015 +0200
@@ -60,15 +60,16 @@
             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:
+                continue
+
+            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
         return closed, total - closed
 
     def current_sessions(self):