Skip to content

Commit 22f84a8

Browse files
committed
doc: add note that we can't incrementally clean old records from db
The clean operation can take a while. I considered setting a time limit so it would clean as many records as it can within a time limit (e.g. 2 seconds) and then return from clean. However the callers expect that all old record are removed so that looking for a matching session key, csrf key etc. will match ONLY unexpired records. They don't check the __timestamp returned. So clean MUST destroy all expired records before returning.
1 parent 6f5bd00 commit 22f84a8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

roundup/backends/sessions_dbm.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ def updateTimestamp(self, sessid):
201201

202202
def clean(self):
203203
''' Remove session records that haven't been used for a week. '''
204+
''' Note: deletion of old keys must be completed when this method
205+
returns. Calling code must not have any expired keys present
206+
after this returns or expired keys could be used to validate
207+
a user. This can mean a long delay when expiring but ....'''
204208
now = time.time()
205209
week = 60*60*24*7
206210
a_week_ago = now - week

0 commit comments

Comments
 (0)