Commit d7d2ff93 authored by Michal Čihař's avatar Michal Čihař

Optimize session cleanup code

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 9b52414a
......@@ -49,9 +49,10 @@ def cleanup_session(session):
'''
now = int(time.time())
for key in session.keys():
if not key.startswith('search_'):
continue
value = session[key]
if (key.startswith('search_')
and (not isinstance(value, dict) or value['ttl'] < now)):
if not isinstance(value, dict) or value['ttl'] < now:
del session[key]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment