From c053c590f29c77f8384d1ca9fdeafc314af39c99 Mon Sep 17 00:00:00 2001 From: Samuel Corsi-House Date: Sat, 8 Nov 2025 18:17:38 -0500 Subject: [PATCH] fix(structlog): don't lose logs when flushing --- src/axiom_py/structlog.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/axiom_py/structlog.py b/src/axiom_py/structlog.py index e435544..9da4718 100644 --- a/src/axiom_py/structlog.py +++ b/src/axiom_py/structlog.py @@ -29,8 +29,9 @@ def flush(self): self.last_run = time.monotonic() if len(self.buffer) == 0: return - self.client.ingest_events(self.dataset, self.buffer) - self.buffer = [] + buffer = self.buffer.copy() + self.buffer = self.buffer[len(self.buffer):] + self.client.ingest_events(self.dataset, buffer) def __call__(self, logger: object, method_name: str, event_dict: object): self.buffer.append(event_dict.copy())