From 7a55526d0a65bcec49ee20ffc18555d82761c812 Mon Sep 17 00:00:00 2001 From: Angus Jelinek Date: Wed, 25 Dec 2024 14:07:48 -0500 Subject: [PATCH] fix: Flush zstd and correctly get buffer size --- python/langsmith/_internal/_background_thread.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/langsmith/_internal/_background_thread.py b/python/langsmith/_internal/_background_thread.py index ef83ac23f..82c1c35c7 100644 --- a/python/langsmith/_internal/_background_thread.py +++ b/python/langsmith/_internal/_background_thread.py @@ -100,7 +100,8 @@ def _tracing_thread_drain_compressed_buffer( ) -> Optional[io.BytesIO]: assert client.compressed_runs is not None with client.compressed_runs.lock: - current_size = client.compressed_runs.buffer.tell() + client.compressed_runs.compressor_writer.flush() + current_size = client.compressed_runs.buffer.getbuffer().nbytes if size_limit is not None and size_limit <= 0: raise ValueError(f"size_limit must be positive; got {size_limit}")