yifan-c commented on code in PR #211:
URL: https://github.com/apache/cassandra-sidecar/pull/211#discussion_r2004522493


##########
server/src/main/java/org/apache/cassandra/sidecar/coordination/ClusterLeaseClaimTask.java:
##########
@@ -144,7 +146,16 @@ public ScheduleDecision scheduleDecision()
     @Override
     public DurationSpec initialDelay()
     {
-        return periodicTaskConfiguration.initialDelay();
+        // Return a randomized delay to introduce jitter among all the 
instances participating
+        // in the lease claim process
+        long randomDeltaDelayMillis = configuration.randomDeltaDelayMillis();
+        if (randomDeltaDelayMillis == 0)
+        {
+            // no jitter
+            return configuration.initialDelay();
+        }
+        long initialDelayMillis = configuration.initialDelay().toMillis() + 
randomDeltaDelayMillis;
+        return new MillisecondBoundConfiguration(initialDelayMillis, 
TimeUnit.MILLISECONDS);

Review Comment:
   👍 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to