frankgh commented on code in PR #211:
URL: https://github.com/apache/cassandra-sidecar/pull/211#discussion_r2004467742


##########
server/src/main/java/org/apache/cassandra/sidecar/coordination/ClusterLeaseClaimTask.java:
##########
@@ -144,7 +147,13 @@ 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
+        MillisecondBoundConfiguration initialDelay = 
periodicTaskConfiguration.initialDelay();
+        long millis = initialDelay.toMillis();
+        return millis <= 0
+               ? initialDelay
+               : new 
MillisecondBoundConfiguration(ThreadLocalRandom.current().nextLong(millis), 
TimeUnit.MILLISECONDS);

Review Comment:
   I think that's fine, but I would probably like to address it as part of a 
different effort. What do you think ?  In that case we'd also need to address 
the randomized initial delay in 
`org.apache.cassandra.sidecar.datahub.SchemaReportingTask#initialDelay`



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to