diff --git a/fireflies/src/main/java/com/salesforce/apollo/fireflies/Parameters.java b/fireflies/src/main/java/com/salesforce/apollo/fireflies/Parameters.java index 803dcfa44..ec5aa1df1 100644 --- a/fireflies/src/main/java/com/salesforce/apollo/fireflies/Parameters.java +++ b/fireflies/src/main/java/com/salesforce/apollo/fireflies/Parameters.java @@ -13,7 +13,7 @@ */ public record Parameters(int joinRetries, int minimumBiffCardinality, int rebuttalTimeout, int viewChangeRounds, int finalizeViewRounds, double fpr, int maximumTxfr, Duration retryDelay, int maxPending, - Duration seedingTimeout, int validationRetries, int crowns) { + Duration seedingTimeout, int validationRetries, int crowns, Duration populateDuration) { public static Builder newBuilder() { return new Builder(); @@ -68,11 +68,12 @@ public static class Builder { * Minimum number of rounds to check for view change */ private int viewChangeRounds = 7; + private Duration populateDuration = Duration.ofMillis(20); public Parameters build() { return new Parameters(joinRetries, minimumBiffCardinality, rebuttalTimeout, viewChangeRounds, finalizeViewRounds, fpr, maximumTxfr, retryDelay, maxPending, seedingTimout, - validationRetries, crowns); + validationRetries, crowns, populateDuration); } public int getCrowns() { @@ -138,6 +139,15 @@ public Builder setMinimumBiffCardinality(int minimumBiffCardinality) { return this; } + public Duration getPopulateDuration() { + return populateDuration; + } + + public Builder setPopulateDuration(Duration populateDuration) { + this.populateDuration = populateDuration; + return this; + } + public int getRebuttalTimeout() { return rebuttalTimeout; } diff --git a/fireflies/src/main/java/com/salesforce/apollo/fireflies/View.java b/fireflies/src/main/java/com/salesforce/apollo/fireflies/View.java index 65346def8..1a32112fb 100644 --- a/fireflies/src/main/java/com/salesforce/apollo/fireflies/View.java +++ b/fireflies/src/main/java/com/salesforce/apollo/fireflies/View.java @@ -443,7 +443,7 @@ void processUpdates(Gossip gossip) { * @param ring */ boolean redirect(Participant member, Gossip gossip, int ring) { - if (!gossip.hasRedirect()) { + if (gossip.getRedirect().equals(SignedNote.getDefaultInstance())) { log.warn("Redirect from: {} on ring: {} did not contain redirect member note on: {}", member.getId(), ring, node.getId()); return false; @@ -1060,7 +1060,7 @@ private void gossip(Optional result, RingCommunications.Destination redirect(member, gossip, destination.ring())); } else if (viewManagement.joined()) { try { diff --git a/fireflies/src/main/java/com/salesforce/apollo/fireflies/ViewManagement.java b/fireflies/src/main/java/com/salesforce/apollo/fireflies/ViewManagement.java index 7124e4fd3..5a62ea8d0 100644 --- a/fireflies/src/main/java/com/salesforce/apollo/fireflies/ViewManagement.java +++ b/fireflies/src/main/java/com/salesforce/apollo/fireflies/ViewManagement.java @@ -386,7 +386,7 @@ void populate(List sample) { return view.gossip(link, 0); }, (futureSailor, link, m) -> { futureSailor.ifPresent(g -> { - if (g.hasRedirect()) { + if (!g.getRedirect().equals(SignedNote.getDefaultInstance())) { final Participant member = (Participant) link.getMember(); view.stable(() -> view.redirect(member, g, 0)); } else { @@ -396,10 +396,10 @@ void populate(List sample) { return !joined(); }, () -> { if (!joined()) { - scheduler.schedule(() -> Thread.ofVirtual().start(Utils.wrapped(repopulate.get(), log)), 500, - TimeUnit.MILLISECONDS); + scheduler.schedule(() -> Thread.ofVirtual().start(Utils.wrapped(repopulate.get(), log)), + params.populateDuration().toNanos(), TimeUnit.NANOSECONDS); } - }, Duration.ofMillis(500))); + }, params.populateDuration())); repopulate.get().run(); }