Skip to content

Commit

Permalink
Fix shard recovery manager random interval
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Leclercq authored and ggreg committed Nov 17, 2016
1 parent aa02058 commit be6332c
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -142,7 +142,9 @@ private void enqueueMissingShards()
{
missingShardExecutor.scheduleWithFixedDelay(() -> {
try {
SECONDS.sleep(ThreadLocalRandom.current().nextInt(1, 30));
// jitter to avoid overloading database
long interval = missingShardDiscoveryInterval.roundTo(SECONDS);
SECONDS.sleep(ThreadLocalRandom.current().nextLong(1, interval));
for (ShardMetadata shard : getMissingShards()) {
stats.incrementBackgroundShardRecovery();
Futures.addCallback(
Expand Down

0 comments on commit be6332c

Please sign in to comment.