Add minimum timeout for Netty messages
Change-Id: I18801cbad57f05d2f3add5a0c3705e0d6e89ae05
diff --git a/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/NettyMessagingManager.java b/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/NettyMessagingManager.java
index 284251b..a5c5f3b 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/NettyMessagingManager.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/NettyMessagingManager.java
@@ -109,6 +109,7 @@
private static final int MIN_SAMPLES = 25;
private static final double PHI_FACTOR = 1.0 / Math.log(10.0);
private static final int PHI_FAILURE_THRESHOLD = 5;
+ private static final long MIN_TIMEOUT_MILLIS = 100;
private static final long MAX_TIMEOUT_MILLIS = 15000;
private static final int CHANNEL_POOL_SIZE = 8;
@@ -760,7 +761,8 @@
try {
RequestMonitor requestMonitor = requestMonitors.get(callback.type, RequestMonitor::new);
long elapsedTime = currentTime - callback.time;
- if (elapsedTime > MAX_TIMEOUT_MILLIS || requestMonitor.isTimedOut(elapsedTime)) {
+ if (elapsedTime > MAX_TIMEOUT_MILLIS ||
+ (elapsedTime > MIN_TIMEOUT_MILLIS && requestMonitor.isTimedOut(elapsedTime))) {
iterator.remove();
requestMonitor.addReplyTime(elapsedTime);
callback.completeExceptionally(