diff --git a/hub_api/helpers/session_helper.py b/hub_api/helpers/session_helper.py index 8f73ce4..5fff078 100644 --- a/hub_api/helpers/session_helper.py +++ b/hub_api/helpers/session_helper.py @@ -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))