fix: bugfix to avoid reprocessing when no data update available

This commit is contained in:
2023-08-10 14:57:48 +02:00
parent ba4b8f8f02
commit a9d9c7d440

View File

@@ -143,12 +143,14 @@ class StreamProcessorPx(StreamProcessor):
# TODO debug code for timing
#
data_msgs = self._get_data(proj_nr)
if data_msgs is None:
continue
data.extend([msg.content["signals"]["data"] for msg in data_msgs if msg is not None])
# print(f"Loading took {time.time() - start}")
start = time.time()
result = self.process(data, metadata)
print(f"Processing took {time.time() - start}")
if not result:
if result is None:
continue
print(f"Length of data is {result[0][0]['z'].shape}")
msg = BECMessage.ProcessedDataMessage(data=result[0][0], metadata=result[1]).dumps()
@@ -170,7 +172,7 @@ class StreamProcessorPx(StreamProcessor):
f"px_stream/projection_{proj_nr}/data", self.num_received_msgs, -1
)
if not msgs:
return []
return None
self.num_received_msgs += len(msgs)
return [BECMessage.DeviceMessage.loads(msg) for msg in msgs]