Skip to content

Commit e557583

Browse files
committed
Drop log events once buffer hits hard limit
1 parent bbc35bb commit e557583

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sentry/src/main/java/io/sentry/logger/LoggerBatchProcessor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public final class LoggerBatchProcessor implements ILoggerBatchProcessor {
2424

2525
public static final int FLUSH_AFTER_MS = 5000;
2626
public static final int MAX_BATCH_SIZE = 100;
27+
public static final int MAX_QUEUE_SIZE = 1000;
2728

2829
private final @NotNull SentryOptions options;
2930
private final @NotNull ISentryClient client;
@@ -46,6 +47,9 @@ public LoggerBatchProcessor(
4647

4748
@Override
4849
public void add(final @NotNull SentryLogEvent logEvent) {
50+
if (pendingCount.getCount() >= MAX_QUEUE_SIZE) {
51+
return;
52+
}
4953
pendingCount.increment();
5054
queue.offer(logEvent);
5155
maybeSchedule(false, false);

0 commit comments

Comments
 (0)