ProgressTracker: Decrease delay due nearestAllowed 38/60438/2
authorVratko Polak <vrpolak@cisco.com>
Fri, 7 Jul 2017 11:14:57 +0000 (13:14 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 17 Jul 2017 08:06:56 +0000 (08:06 +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>
(cherry picked from commit 80e6514d56cd4dc6aa40997dea2b460723148341)

opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/ProgressTracker.java

index 699c102297373bd11397efcb095c406730076c00..027b35d873f864457588631a426c7350029f4caa 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 Math.max(now, nearestAllowed) + estimateIsolatedDelay(now);
+        return Math.max(now, nearestAllowed + estimateIsolatedDelay(now));
     }
 
     // State-altering public methods.