Rename session_garbage_collector to expired_sessions_collector

This commit is contained in:
Guille Gutierrez 2023-02-23 05:04:40 -05:00
parent febaf1a50d
commit f8ff0d15f5
2 changed files with 4 additions and 5 deletions

View File

@ -42,7 +42,7 @@ with open("hub_api/docs/openapi-specs.yml", "r") as stream:
"model_filter": lambda tag: True, # all in
}
],
"static_url_path": "/flasgger_static",
"static_url_path": "/api/v1.4/static",
"specs_route": "/v1.4/api-docs/",
"openapi": "3.0.0"
}
@ -56,5 +56,5 @@ with open("hub_api/docs/openapi-specs.yml", "r") as stream:
def home():
return Response(headers={'Access-Control-Allow-Origin': '*'})
threading.Thread(target=sh.session_garbage_collector, daemon=True, args="5").start()
threading.Thread(target=sh.expired_sessions_collector, daemon=True, args="5").start()
app.run(port=15789, host="0.0.0.0", debug=True)

View File

@ -56,7 +56,7 @@ class SessionData:
return usage_catalog
def session_garbage_collector(session_timeout_duration):
def expired_sessions_collector(session_timeout_duration):
# loop through all sessions and remove expired sessions
while True:
if bool(sessions):
@ -65,7 +65,6 @@ def session_garbage_collector(session_timeout_duration):
if _expire < datetime.datetime.now():
print("session with session_id: ", session, "expired.")
del sessions[session]
time.sleep(60*int(session_timeout_duration))
def _validate_session(session_id, token, application_uuid):