in share/multiline.py [0:0]
def collect(self) -> CollectIterator:
last_iteration_datetime: datetime.datetime = datetime.datetime.now(datetime.UTC)
for data, newline in self.feed:
if not self._matcher(data):
if self._buffer.is_empty():
self._buffer.grow(data, newline)
yield self._buffer.collect_and_reset()
else:
content, current_length, _ = self._buffer.collect_and_reset()
self._buffer.grow(data, newline)
yield content, current_length, newline
content, current_length, _ = self._buffer.collect_and_reset()
yield content, current_length, newline
else:
self._buffer.grow(data, newline)
# no pre collect buffer in while multiline, let's check the circuit breaker after at least one grow
if (datetime.datetime.now(datetime.UTC) - last_iteration_datetime) > timedelta_circuit_breaker:
yield self._buffer.collect_and_reset()
if not self._buffer.is_empty():
yield self._buffer.collect_and_reset()