diff --git a/rl_hm/backend/main.py b/rl_hm/backend/main.py index 40136c85cad911580a50d7fe2c1d880067e0f8d4..a6da8b1067f1434e87cb3023f3108db9f593ca9e 100644 --- a/rl_hm/backend/main.py +++ b/rl_hm/backend/main.py @@ -39,8 +39,11 @@ def _update_loop(socket_io: socketio.Server, try: payload_dict = json.loads(decoded_string) - except json.decoder.JSONDecodeError: + except json.decoder.JSONDecodeError as json_exception: # if the received data is corrupted, just ignore this packet + LOGGER.error("JSONDecodeError while parsing received payload: %s", str(json_exception)) + LOGGER.error("received payload: %s", decoded_string) + continue source: str = payload_dict.pop('source') @@ -78,7 +81,6 @@ def callback_disconnect(*args) -> None: def main() -> None: # Run the update loop that gets updates from the data fetcher. - # It keeps the local `STATE_DICT` updated socket_io.start_background_task(target=_update_loop, socket_io=socket_io, data_fetcher_socket=data_fetcher_socket)