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}")