Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase large event queue warn limit #3702

Merged
merged 1 commit into from
Jul 14, 2023
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
@NonNullByDefault
public class EventHandler implements AutoCloseable {

private static final int EVENT_QUEUE_WARN_LIMIT = 5000;
private static final long EVENTSUBSCRIBER_EVENTHANDLING_MAX_MS = TimeUnit.SECONDS.toMillis(5);

private final Logger logger = LoggerFactory.getLogger(EventHandler.class);
Expand Down Expand Up @@ -154,10 +155,9 @@ private synchronized void dispatchEvent(final Set<EventSubscriber> eventSubscrib
ExecutorRecord executorRecord = Objects.requireNonNull(
executors.computeIfAbsent(eventSubscriber.getClass(), this::createExecutorRecord));
int queueSize = executorRecord.count().incrementAndGet();
if (queueSize > 1000) {
logger.warn(
"The queue for a subscriber of type '{}' exceeds 1000 elements. System may be unstable.",
eventSubscriber.getClass());
if (queueSize > EVENT_QUEUE_WARN_LIMIT) {
logger.warn("The queue for a subscriber of type '{}' exceeds {} elements. System may be unstable.",
eventSubscriber.getClass(), EVENT_QUEUE_WARN_LIMIT);
}
CompletableFuture.runAsync(() -> {
ScheduledFuture<?> logTimeout = executorRecord.watcher().schedule(
Expand Down