fix: fix backend code for redis raw data

This commit is contained in:
x10da
2026-05-21 15:17:56 +02:00
committed by appel_c
parent 6cc3bb9c4a
commit 05c567ba99
@@ -102,12 +102,12 @@ class TimepixFlyBackend:
self.timepix_fly_client.on_connected(timeout=timeout / 2)
if self.redis_connector is not None:
self.redis_connector.register(
self._timepix_redis_topic, self._raw_data_redis_callback
self._timepix_redis_topic, cb=self._raw_data_redis_callback
)
# status = self.start_data_server()
# status.wait(timeout=timeout / 2)
except Exception: # pylint: disable=broad-except
except Exception as exc: # pylint: disable=broad-except
content = traceback.format_exc()
logger.error(f"Error starting data server: {content}")
# pylint: disable=raise-missing-from
@@ -355,7 +355,7 @@ class TimepixFlyBackend:
Args:
message (str): The JSON string received from Redis containing the raw data.
"""
self._decode_received_data(message)
self._process_timepix_fly_msg(message.value.data)
def start_data_server(self) -> StatusBase:
"""
@@ -484,6 +484,9 @@ class TimepixFlyBackend:
except json.JSONDecodeError:
logger.error(f"TimePixFlyBackend: Failed to decode JSON from buffer: {buffer}")
return # TODO should this raise, or only log error as of now?
self._process_timepix_fly_msg(obj)
def _process_timepix_fly_msg(self, obj: dict) -> None:
if obj.get("type", "") == "StartFrame":
# Clear the message buffer when a new StartFrame is received, to avoid mixing messages from different acquisitions.
if self.__msg_buffer: