--- a/etwist/server.py Mon Apr 19 13:35:57 2010 +0200
+++ b/etwist/server.py Mon Apr 19 13:37:32 2010 +0200
@@ -124,10 +124,8 @@
CW_EVENT_MANAGER.bind('after-registry-reload', self.set_url_rewriter)
def start_service(self):
- config = self.config
- interval = min(config['cleanup-session-time'] or 120,
- config['cleanup-anonymous-session-time'] or 720) / 2.
- start_task(interval, self.appli.session_handler.clean_sessions)
+ start_task(self.appli.session_handler.clean_sessions_interval,
+ self.appli.session_handler.clean_sessions)
def set_url_rewriter(self):
self.url_rewriter = self.appli.vreg['components'].select_or_none('urlrewriter')
--- a/web/application.py Mon Apr 19 13:35:57 2010 +0200
+++ b/web/application.py Mon Apr 19 13:37:32 2010 +0200
@@ -43,6 +43,15 @@
self.cleanup_anon_session_time = (vreg.config['cleanup-anonymous-session-time'] or 5) * 60
assert self.cleanup_anon_session_time > 0
self.authmanager = vreg['components'].select('authmanager', vreg=vreg)
+ if vreg.config.anonymous_user() is not None:
+ self.clean_sessions_interval = min(
+ 5 * 60,
+ self.cleanup_session_time / 2.,
+ self.cleanup_anon_session_time / 2.)
+ else:
+ self.clean_sessions_interval = min(
+ 5 * 60,
+ self.cleanup_session_time / 2.)
def clean_sessions(self):
"""cleanup sessions which has not been unused since a given amount of
@@ -138,6 +147,10 @@
global SESSION_MANAGER
SESSION_MANAGER = self.session_manager
+ @property
+ def clean_sessions_interval(self):
+ return self.session_manager.clean_sessions_interval
+
def clean_sessions(self):
"""cleanup sessions which has not been unused since a given amount of
time