Mercurial > p > roundup > code
diff roundup/backends/sessions_rdbms.py @ 3606:04dc3eef67b7
reduced frequency of session timestamp update
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 27 Apr 2006 04:03:11 +0000 |
| parents | ac4f295499a4 |
| children | 7ad206564007 |
line wrap: on
line diff
--- a/roundup/backends/sessions_rdbms.py Thu Apr 27 03:48:41 2006 +0000 +++ b/roundup/backends/sessions_rdbms.py Thu Apr 27 04:03:11 2006 +0000 @@ -1,4 +1,4 @@ -#$Id: sessions_rdbms.py,v 1.3 2004-05-02 23:16:05 richard Exp $ +#$Id: sessions_rdbms.py,v 1.4 2006-04-27 04:03:11 richard Exp $ """This module defines a very basic store that's used by the CGI interface to store session and one-time-key information. @@ -77,9 +77,12 @@ self.name, self.db.arg), (infoid,)) def updateTimestamp(self, infoid): - self.cursor.execute('update %ss set %s_time=%s where %s_key=%s'%( - self.name, self.name, self.db.arg, self.name, self.db.arg), - (time.time(), infoid)) + ''' don't update every hit - once a minute should be OK ''' + now = time.time() + self.cursor.execute('''update %ss set %s_time=%s where %s_key=%s + and %s_time < %s'''%(self.name, self.name, self.db.arg, + self.name, self.db.arg, self.name, self.db.arg), + (now, infoid, now-60)) def clean(self, now): """Age sessions, remove when they haven't been used for a week.
