Skip to content

Commit 684e513

Browse files
committed
merge doc fix and perf fix/warning to session_dbm.py:clean()
2 parents 378e849 + ce73dd2 commit 684e513

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

doc/customizing.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1892,7 +1892,7 @@ To edit the status of all items in the item index view, edit the
18921892
and at the bottom of that table add::
18931893

18941894
</table>
1895-
</form
1895+
</form>
18961896

18971897
making sure you match the ``</table>`` from the list table, not the
18981898
navigation table or the subsequent form table.

roundup/backends/sessions_dbm.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,18 @@ def clean(self):
203203
''' Remove session records that haven't been used for a week. '''
204204
now = time.time()
205205
week = 60*60*24*7
206+
a_week_ago = now - week
206207
for sessid in self.list():
207208
sess = self.get(sessid, '__timestamp', None)
208209
if sess is None:
209210
self.updateTimestamp(sessid)
210211
continue
211-
interval = now - sess
212-
if interval > week:
212+
if a_week_ago > sess:
213213
self.destroy(sessid)
214214

215+
run_time = time.time() - now
216+
if run_time > 3:
217+
self.log_warning("clean() took %.2fs", run_time)
215218

216219
class Sessions(BasicDatabase):
217220
name = 'sessions'

0 commit comments

Comments
 (0)