mirror of
https://github.com/danieldemus/openhab-core.git
synced 2026-07-29 12:34:22 +02:00
Increase large event queue warn limit (#3702)
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 <github@klug.nrw>
This commit is contained in:
+4
-4
@@ -44,6 +44,7 @@ import org.slf4j.LoggerFactory;
|
||||
@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);
|
||||
@@ -154,10 +155,9 @@ public class EventHandler implements AutoCloseable {
|
||||
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(
|
||||
|
||||
Reference in New Issue
Block a user