From dc7155d67238b79954f5c250bc72499a59a14125 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Fri, 29 Jun 2012 03:33:47 +0200 Subject: [PATCH] Fixed up session-db cleaner-running checks. --- wrw/session.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/wrw/session.py b/wrw/session.py index 3b2b2b2..edf8f7d 100644 --- a/wrw/session.py +++ b/wrw/session.py @@ -157,15 +157,17 @@ class db(object): else: raise Exception("Illegal session entry: " + repr(entry[1])) - def fetch(self, req): - now = int(time.time()) - sessid = cookie.get(req, self.cookiename) - new = False + def checkclean(self): with self.lock: if self.cthread is None: self.cthread = threading.Thread(target = self.cleanloop) self.cthread.setDaemon(True) self.cthread.start() + + def fetch(self, req): + now = int(time.time()) + sessid = cookie.get(req, self.cookiename) + new = False try: if sessid is None: raise KeyError() @@ -184,6 +186,7 @@ class db(object): self.freeze(sess) except: pass + self.checkclean() req.oncommit(ckfreeze) return sess -- 2.11.0