From 188da534e89448f61f9ef1b0d92c0c7f5614b040 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Thu, 26 May 2011 01:56:45 +0200 Subject: [PATCH] Fixed session cleaning bug. --- wrw/session.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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: -- 2.11.0