Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sentry_sdk/_log_batcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

class LogBatcher:
MAX_LOGS_BEFORE_FLUSH = 100
MAX_LOGS_BEFORE_DROP = 1_000
FLUSH_WAIT_TIME = 5.0

def __init__(
Expand Down Expand Up @@ -79,6 +80,9 @@ def add(
return None

with self._lock:
if len(self._log_buffer) >= self.MAX_LOGS_BEFORE_DROP:
return None

self._log_buffer.append(log)
if len(self._log_buffer) >= self.MAX_LOGS_BEFORE_FLUSH:
self._flush_event.set()
Expand Down