Config: fix bug where active_session code be none therby throwing an error
This commit is contained in:
+13
-1
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user