Author: chrisz
Date: Tue Jan 30 16:43:05 2007
New Revision: 6159
Modified:
Webware/trunk/WebKit/SessionStore.py
Log:
Changed cleanStaleSessions() to iterate over the keys, rather than the items, so that cleanStaleSessions() will not load all sessions into memory. (Patch #1646644 submitted by Ben Parker.)
Modified: Webware/trunk/WebKit/SessionStore.py
==============================================================================
--- Webware/trunk/WebKit/SessionStore.py (original)
+++ Webware/trunk/WebKit/SessionStore.py Tue Jan 30 16:43:05 2007
@@ -116,9 +116,18 @@
"""
curTime = time.time()
- for key, sess in self.items():
- if (curTime - sess.lastAccessTime()) >= sess.timeout() or sess.timeout()==0:
- del self[key]
+ for key in self.keys():
+ try:
+ sess = self[key]
+ except KeyError:
+ pass # session was already deleted by some other thread
+ else:
+ if curTime - sess.lastAccessTime() >= sess.timeout() \
+ or sess.timeout() == 0:
+ try:
+ del self[key]
+ except KeyError:
+ pass # already deleted by some other thread
## Convenience methods ##
|