Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 8e5221cf authored by LEPAGE Gaetan's avatar LEPAGE Gaetan
Browse files

[backend] better handling of unparseable messages from the data fetcher

parent aff16b96
No related branches found
No related tags found
No related merge requests found
Pipeline #356560 passed
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment