From: Fredrik Tolf Date: Wed, 25 May 2011 23:56:45 +0000 (+0200) Subject: Fixed session cleaning bug. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=188da534e89448f61f9ef1b0d92c0c7f5614b040;p=wrw.git Fixed session cleaning bug. --- diff --git a/wrw/session.py b/wrw/session.py index 513725d..1fded4a 100644 --- a/wrw/session.py +++ b/wrw/session.py @@ -76,7 +76,6 @@ class db(object): self.cookiename = cookiename self.path = path self.lock = threading.Lock() - self.lastuse = 0 self.cthread = None self.freezetime = 3600 @@ -99,18 +98,17 @@ class db(object): def cleanloop(self): try: - lastuse = self.lastuse - while self.lastuse >= lastuse: - lastuse = self.lastuse + while True: time.sleep(300) self.clean() + if len(self.live) == 0: + break finally: with self.lock: self.cthread = None def fetch(self, req): now = int(time.time()) - self.lastuse = now sessid = cookie.get(req, self.cookiename) with self.lock: if self.cthread is None: