Skip to content

Commit

Permalink
Ensure sequence scan does not over-eat in send_next.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeyer committed Jan 29, 2024
1 parent 7e32fe6 commit 64365c6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nion/instrumentation/scan_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2175,7 +2175,9 @@ def _progress(self) -> float:

def _send_next(self) -> typing.Sequence[Acquisition.DataStreamEventArgs]:
data_stream_events = list[Acquisition.DataStreamEventArgs]()
while self.__scan_hardware_source.get_sequence_buffer_count() > 0 and self.__sent_count < self.__count and not self.__is_aborted:
start_time = time.time()
MAX_TIME = 0.1
while self.__scan_hardware_source.get_sequence_buffer_count() > 0 and self.__sent_count < self.__count and not self.__is_aborted and time.time() - start_time < MAX_TIME:
buffer_data = self.__scan_hardware_source.pop_sequence_buffer_data(self.__scan_id)
self.__sent_count += 1

Expand Down

0 comments on commit 64365c6

Please sign in to comment.