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 #27607
This commit is contained in:
Lee Hinman 2018-01-26 11:36:44 -07:00
parent be74f11517
commit c25a4637e8

View File

@ -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();