Module: check_mk
Branch: master
Commit: 1ed6c8b84b58c29a117fa3d6293a9ddb5c1578c7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1ed6c8b84b58c2…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Aug 22 13:15:33 2016 +0200
User transids: Only saving up to 20 per user (should be way enough)
---
web/htdocs/htmllib.py | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 022b51a..6692f99 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -1851,10 +1851,9 @@ class html(GUITester):
return self.current_transid
- # Marks a transaction ID as used. This is done by saving
- # it in a user specific settings file "transids.mk". At this
- # time we remove all entries from that list that are older
- # than one week.
+ # All generated transids are saved per user. They are stored
+ # in the transids and per user only up to 20 transids are kept.
+ # Transaction ids older than one day are deleted.
def store_new_transids(self):
if self.new_transids:
valid_ids = self.load_transids(lock = True)
@@ -1864,7 +1863,7 @@ class html(GUITester):
timestamp, rand = valid_id.split("/")
if now - int(timestamp) < 86400: # one day
cleared_ids.append(valid_id)
- self.save_transids(cleared_ids + self.new_transids, unlock = True)
+ self.save_transids((cleared_ids + self.new_transids)[-20:], unlock = True)
# Remove the used transid from the list of valid ones