Skip to content

Commit

Permalink
Increase large event queue warn limit (#3702)
Browse files Browse the repository at this point in the history
On larger installations with 1000+ items the limit of 1000 elements in the queue is exceeded easily. Since no events are lost (they just take longer to be processed), the limit that needs to be exceeded before a warning is issued should be increased.

See reports on the forum.

Signed-off-by: Jan N. Klug <[email protected]>
  • Loading branch information
J-N-K authored Jul 14, 2023
1 parent f0c0095 commit 141b7b6
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 141b7b6

Please sign in to comment.