From a9d9c7d44049315fc15b0c498683e73d1e61da8d Mon Sep 17 00:00:00 2001 From: appel_c Date: Thu, 10 Aug 2023 14:57:48 +0200 Subject: [PATCH] fix: bugfix to avoid reprocessing when no data update available --- bec_plugins/data_processing/px_example.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bec_plugins/data_processing/px_example.py b/bec_plugins/data_processing/px_example.py index 88fac4d..bcf3b76 100644 --- a/bec_plugins/data_processing/px_example.py +++ b/bec_plugins/data_processing/px_example.py @@ -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]