correct expired sessions collector
This commit is contained in:
parent
cb9b9bb251
commit
b06a1d3d53
|
@ -23,13 +23,14 @@ def expired_sessions_collector(session_timeout_duration):
|
|||
"""
|
||||
while True:
|
||||
if bool(sessions):
|
||||
for _session in list(sessions):
|
||||
print(_session)
|
||||
_expire = datetime.datetime.strptime(_session['expire'], '%Y-%m-%d %H:%M:%S.%f')
|
||||
for session_uuid in sessions:
|
||||
print(sessions)
|
||||
print(sessions[session_uuid]['expire'])
|
||||
_expire = datetime.datetime.strptime(sessions[session_uuid]['expire'], '%Y-%m-%d %H:%M:%S.%f')
|
||||
if _expire < datetime.datetime.now():
|
||||
print("session for user: ", _session['username'], "expired.")
|
||||
print("session for user: ", sessions[session_uuid]['user'], "expired.")
|
||||
|
||||
del sessions[session]
|
||||
del sessions[session_uuid]
|
||||
time.sleep(60 * int(session_timeout_duration))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user