From 6d9df65d024caad25fc64b21df6d98af032bf27b Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Tue, 21 Dec 2021 14:03:24 -0700 Subject: [PATCH] Catch `FileNotFound` when clearing invalid sessions The server now consumes the FNF error if an invalid session is found but is deleted in an earlier thread. Fixes #577 --- app/routes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/routes.py b/app/routes.py index 65f4113..164f287 100644 --- a/app/routes.py +++ b/app/routes.py @@ -85,7 +85,11 @@ def session_required(f): pass for invalid_session in invalid_sessions: - os.remove(invalid_session) + try: + os.remove(invalid_session) + except FileNotFoundError: + # Don't throw error if the invalid session has been removed + pass return f(*args, **kwargs)