From bce331091338a78d07c78db6adab35911d41dea4 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Wed, 21 Dec 2011 06:46:03 +0100 Subject: [PATCH] Don't commit sessions to db.live before they are dirty. --- wrw/session.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wrw/session.py b/wrw/session.py index 2abe650..28c1577 100644 --- a/wrw/session.py +++ b/wrw/session.py @@ -129,14 +129,15 @@ class db(object): sess.atime = now except KeyError: sess = session() - self.live[sess.id] = sess new = True def ckfreeze(req): if sess.dirty(): + if new: + cookie.add(req, self.cookiename, sess.id, self.path) + with self.lock: + self.live[sess.id] = sess try: - if new: - cookie.add(req, self.cookiename, sess.id, self.path) self.freeze(sess) except: pass -- 2.11.0