diff --git a/server/src/main/java/org/opensearch/common/util/BatchRunnableExecutor.java b/server/src/main/java/org/opensearch/common/util/BatchRunnableExecutor.java index 6b32be5490563..4ae139ada7d2c 100644 --- a/server/src/main/java/org/opensearch/common/util/BatchRunnableExecutor.java +++ b/server/src/main/java/org/opensearch/common/util/BatchRunnableExecutor.java @@ -44,7 +44,7 @@ public void run() { return; } for (TimeoutAwareRunnable workQueue : timeoutAwareRunnables) { - if (System.nanoTime() - startTime > timeoutSupplier.get().nanos()) { + if (System.nanoTime() - startTime < timeoutSupplier.get().nanos()) { workQueue.run(); } else { logger.debug("Executing timeout for runnable of size [{}]", timeoutAwareRunnables.size()); diff --git a/server/src/main/java/org/opensearch/gateway/PrimaryShardBatchAllocator.java b/server/src/main/java/org/opensearch/gateway/PrimaryShardBatchAllocator.java index 617902b7506a9..f416166069417 100644 --- a/server/src/main/java/org/opensearch/gateway/PrimaryShardBatchAllocator.java +++ b/server/src/main/java/org/opensearch/gateway/PrimaryShardBatchAllocator.java @@ -122,7 +122,7 @@ public void allocateUnassignedBatch(List shardRoutings, RoutingAll logger.trace("Finished shard allocation execution for unassigned primary shards: {}", shardRoutings.size()); } - public void allocateUnassignedBatchOnTimeout(List shardRoutings, RoutingAllocation allocation) { + protected void allocateUnassignedBatchOnTimeout(List shardRoutings, RoutingAllocation allocation) { Set batchShardRoutingSet = new HashSet<>(shardRoutings); RoutingNodes.UnassignedShards.UnassignedIterator iterator = allocation.routingNodes().unassigned().iterator(); while (iterator.hasNext()) { diff --git a/server/src/main/java/org/opensearch/gateway/ReplicaShardBatchAllocator.java b/server/src/main/java/org/opensearch/gateway/ReplicaShardBatchAllocator.java index 99171b17a99e9..a9da8f3a41161 100644 --- a/server/src/main/java/org/opensearch/gateway/ReplicaShardBatchAllocator.java +++ b/server/src/main/java/org/opensearch/gateway/ReplicaShardBatchAllocator.java @@ -168,7 +168,7 @@ public void allocateUnassignedBatch(List shardRoutings, RoutingAll logger.trace("Finished shard allocation execution for unassigned replica shards: {}", shardRoutings.size()); } - public void allocateUnassignedBatchOnTimeout(List shardRoutings, RoutingAllocation allocation) { + protected void allocateUnassignedBatchOnTimeout(List shardRoutings, RoutingAllocation allocation) { Set shardIdsFromBatch = new HashSet<>(); for (ShardRouting shardRouting : shardRoutings) { ShardId shardId = shardRouting.shardId();