Skip to content

Commit efed20d

Browse files
fix: Add hard limit to log batcher
1 parent 6a76cc5 commit efed20d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sentry_sdk/_log_batcher.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
class LogBatcher:
1515
MAX_LOGS_BEFORE_FLUSH = 100
16+
MAX_LOGS_BEFORE_DROP = 1_000
1617
FLUSH_WAIT_TIME = 5.0
1718

1819
def __init__(
@@ -79,6 +80,9 @@ def add(
7980
return None
8081

8182
with self._lock:
83+
if len(self._log_buffer) >= self.MAX_LOGS_BEFORE_DROP:
84+
return None
85+
8286
self._log_buffer.append(log)
8387
if len(self._log_buffer) >= self.MAX_LOGS_BEFORE_FLUSH:
8488
self._flush_event.set()

0 commit comments

Comments
 (0)