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:
|
while True:
|
||||||
if bool(sessions):
|
if bool(sessions):
|
||||||
for _session in list(sessions):
|
for session_uuid in sessions:
|
||||||
print(_session)
|
print(sessions)
|
||||||
_expire = datetime.datetime.strptime(_session['expire'], '%Y-%m-%d %H:%M:%S.%f')
|
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():
|
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))
|
time.sleep(60 * int(session_timeout_duration))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user