From a726c23c8bf42a3d9e4a175a7448a8dd8a7a133d Mon Sep 17 00:00:00 2001 From: Noble Paul Date: Thu, 17 Sep 2009 11:27:36 +0000 Subject: [PATCH] SOLR-1435 ensure that all slaves with same pollInteval fetches index at same time git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@816144 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/solr/handler/SnapPuller.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/solr/handler/SnapPuller.java b/src/java/org/apache/solr/handler/SnapPuller.java index 4f0f83f39d1..d460b3add8c 100644 --- a/src/java/org/apache/solr/handler/SnapPuller.java +++ b/src/java/org/apache/solr/handler/SnapPuller.java @@ -163,7 +163,8 @@ public class SnapPuller { } }; executorService = Executors.newSingleThreadScheduledExecutor(); - executorService.scheduleAtFixedRate(task, pollInterval, pollInterval, TimeUnit.MILLISECONDS); + long initialDelay = pollInterval - (System.currentTimeMillis() % pollInterval); + executorService.scheduleAtFixedRate(task, initialDelay, pollInterval, TimeUnit.MILLISECONDS); LOG.info("Poll Scheduled at an interval of " + pollInterval + "ms"); }