From 934e59596a6f054fe9efaa582bab01f0bee7b35b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Thu, 5 Nov 2020 10:40:56 +0100 Subject: [PATCH] Adds more logs to session validation (#2219) * Adds more logs to session validation * It's not there * Use debug * format * Create new timestamp if OverflowError --- supervisor/ingress.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/supervisor/ingress.py b/supervisor/ingress.py index e661eb1a9..da36a0919 100644 --- a/supervisor/ingress.py +++ b/supervisor/ingress.py @@ -109,17 +109,19 @@ class Ingress(JsonConfig, CoreSysAttributes): def validate_session(self, session: str) -> bool: """Return True if session valid and make it longer valid.""" if session not in self.sessions: + _LOGGER.debug("Session %f is not known", session) return False # check if timestamp valid, to avoid crash on malformed timestamp try: valid_until = utc_from_timestamp(self.sessions[session]) except OverflowError: - _LOGGER.warning("Session timestamp %f is invalid!", self.sessions[session]) - return False + self.sessions[session] = utcnow() + timedelta(minutes=15) + return True # Is still valid? if valid_until < utcnow(): + _LOGGER.debug("Session is no longer valid (%f/%f)", valid_until, utcnow()) return False # Update time