diff --git a/piker/data/_timeseries.py b/piker/data/_timeseries.py index 7055854b..cc84f763 100644 --- a/piker/data/_timeseries.py +++ b/piker/data/_timeseries.py @@ -209,8 +209,13 @@ def detect_null_time_gap( NOTE: for now presumes only ONE gap XD ''' - zero_pred: np.ndarray = shm.array['time'] == 0 - zero_t: np.ndarray = shm.array[zero_pred] + # ensure we read buffer state only once so that ShmArray rt + # circular-buffer updates don't cause a indexing/size mismatch. + array: np.ndarray = shm.array + + zero_pred: np.ndarray = array['time'] == 0 + zero_t: np.ndarray = array[zero_pred] + if zero_t.size: istart, iend = zero_t['index'][[0, -1]] start, end = shm._array['time'][