Skip to content

Commit

Permalink
Compromise
Browse files Browse the repository at this point in the history
  • Loading branch information
nfcampos committed Jan 25, 2024
1 parent 8d00547 commit ddadf9a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/langsmith/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3142,7 +3142,14 @@ def _tracing_thread_drain_queue(
) -> List[TracingQueueItem]:
next_batch: List[TracingQueueItem] = []
try:
while item := tracing_queue.get(block=block, timeout=0.25):
# wait 250ms for the first item, then
# - drain the queue with a 10ms block timeout
# - stop draining if we hit the limit
# shorter drain timeout is used instead of non-blocking calls to
# avoid creating too many small batches
if item := tracing_queue.get(block=block, timeout=0.25):
next_batch.append(item)
while item := tracing_queue.get(block=block, timeout=0.01):
next_batch.append(item)
if limit and len(next_batch) >= limit:
break
Expand Down

0 comments on commit ddadf9a

Please sign in to comment.