159
return nil, newIterState, err
160
}
162
>
historyBatchSize, err := i.sizeEstimator.EstimateSize(batch)
163
>
if err != nil {
164
return nil, newIterState, err
165
}
167
>
historyBatches = append(historyBatches, batch)
168
>
firstEventID = batch.Events[len(batch.Events)-1].EventId + 1
169
>
170
>
// In case targetSize is satisfied before reaching the end of current set of batches, return immediately.
171
>
// Otherwise, we need to look ahead to see if there's more history batches.
172
>
if size >= targetSize && idx != len(currHistoryBatches)-1 {
173
newIterState.FinishedIteration = false
174
newIterState.NextEventID = firstEventID