Ensure total nanosecond time for tasks is at least 1 nanosecond
In rare cases the total nanoseconds for an entire window of operations can be 0
nanoseconds, causing the assertion in
QueueResizingEsThreadPoolExecutor.calculateLambda to trip. This ensures that we
calculate the lambda value with at least 1 nanosecond.
Resolves
@@ -167,7 +167,7 @@ public final class QueueResizingEsThreadPoolExecutor extends EsThreadPoolExecuto
// Calculate the new desired queue size
try {
- final double lambda = calculateLambda(tasksPerFrame, totalNanos);
+ final double lambda = calculateLambda(tasksPerFrame, Math.max(totalNanos, 1L));
final int desiredQueueSize = calculateL(lambda, targetedResponseTimeNanos);
final int oldCapacity = workQueue.capacity();
