ProgressTracker: Decrease delay due nearestAllowed 71/60071/6
authorVratko Polak <vrpolak@cisco.com>
Fri, 7 Jul 2017 11:14:57 +0000 (13:14 +0200)
committerRobert Varga <nite@hq.sk>
Sat, 15 Jul 2017 01:36:35 +0000 (01:36 +0000)
If nearestAllowed is in past, that means we have
a temporary interval of relatively small demand for tasks.
We can reduce delay, as if the time since nearestAllowed
was a "delay in advance".

This way the queue stays closer to the intended capacity.

Change-Id: I40f95ea9cb25ea62d8c65ee78cafc79e9b56cc11
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/ProgressTracker.java

index 699c102..027b35d 100644 (file)
@@ -219,7 +219,7 @@ abstract class ProgressTracker {
      * @return estimated tick number when all threads with opened tasks are done waiting
      */
     public long estimateAllowed(final long now) {
      * @return estimated tick number when all threads with opened tasks are done waiting
      */
     public long estimateAllowed(final long now) {
-        return Math.max(now, nearestAllowed) + estimateIsolatedDelay(now);
+        return Math.max(now, nearestAllowed + estimateIsolatedDelay(now));
     }
 
     // State-altering public methods.
     }
 
     // State-altering public methods.