Config: fix bug where active_session code be none therby throwing an error

This commit is contained in:
2026-02-24 15:30:59 +01:00
parent 8624ff31ef
commit 6cf36faf30
+13 -1
View File
@@ -135,7 +135,19 @@ class BeamlineConfig:
with redis_lock.Lock(
self.__client, f"{self.__bl}:active_session_lock", expire=10
):
if int(self.__client.get(f"{self.__bl}:active_session")) == session:
raw = self.__client.get(f"{self.__bl}:active_session")
if raw is None:
return
try:
active = int(raw)
except (TypeError, ValueError):
logger.warning(
"Invalid active_session value in redis; ignoring",
extra={"beamline": self.__bl, "raw": raw},
)
return
if active == session:
self.__client.delete(f"{self.__bl}:active_session")
def force_set_active_session(self, session: int, expiry_sec: int) -> None: