diff --git a/addons/io_hubs_addon/debugger.py b/addons/io_hubs_addon/debugger.py index 1897ea49..0b70430a 100644 --- a/addons/io_hubs_addon/debugger.py +++ b/addons/io_hubs_addon/debugger.py @@ -633,9 +633,7 @@ def load_post(dummy): @persistent def update_session(): - if hubs_session.is_alive(): - hubs_session.update_session_state() - + hubs_session.update_session_state() return 2.0 diff --git a/addons/io_hubs_addon/hubs_session.py b/addons/io_hubs_addon/hubs_session.py index 8bfab4e4..0887516c 100644 --- a/addons/io_hubs_addon/hubs_session.py +++ b/addons/io_hubs_addon/hubs_session.py @@ -134,17 +134,23 @@ def __create_instance(self, context): self._web_driver = webdriver.Chrome(options=options) def update_session_state(self): - url = self._web_driver.current_url - from urllib.parse import urlparse - from urllib.parse import parse_qs - parsed = urlparse(url) - params = parse_qs(parsed.query, keep_blank_values=True) - self._room_params = {k: v for k, v in params.items() if k != "hub_id"} - - params = self._web_driver.execute_script(JS_STATE_UPDATE) - self._user_logged_in = params["signedIn"] - self._user_in_room = params["entered"] - self._room_name = params["roomName"] + if self.is_alive(): + url = self._web_driver.current_url + from urllib.parse import urlparse + from urllib.parse import parse_qs + parsed = urlparse(url) + params = parse_qs(parsed.query, keep_blank_values=True) + self._room_params = {k: v for k, v in params.items() if k != "hub_id"} + + params = self._web_driver.execute_script(JS_STATE_UPDATE) + self._user_logged_in = params["signedIn"] + self._user_in_room = params["entered"] + self._room_name = params["roomName"] + + else: + self._user_logged_in = False + self._user_in_room = False + self._room_name = "" def bring_to_front(self, context): # In some systems switch_to doesn't work, the code below is a hack to make it work