Skip to content

Commit

Permalink
Increase the amount of time before ZK gives up (slackhq#771)
Browse files Browse the repository at this point in the history
Co-authored-by: Bryan Burkholder <[email protected]>
  • Loading branch information
bryanlb and bryanlb authored Feb 13, 2024
1 parent 56c0512 commit bfa3a76
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.framework.api.CuratorEventType;
import org.apache.curator.retry.RetryNTimes;
import org.apache.curator.retry.RetryUntilElapsed;
import org.apache.curator.x.async.AsyncCuratorFramework;
import org.apache.zookeeper.Watcher;
import org.slf4j.Logger;
Expand All @@ -22,7 +22,6 @@ public class CuratorBuilder {
private static final Logger LOG = LoggerFactory.getLogger(CuratorBuilder.class);

public static final String METADATA_FAILED_COUNTER = "metadata.failed";
private static final int ZK_RETRY_COUNT = 3;

public static AsyncCuratorFramework build(
MeterRegistry meterRegistry, KaldbConfigs.ZookeeperConfig zkConfig) {
Expand All @@ -34,7 +33,10 @@ public static AsyncCuratorFramework build(
zkConfig.getZkConnectionTimeoutMs() > 0, "connectionTimeoutMs should be a positive number");

Counter failureCounter = meterRegistry.counter(METADATA_FAILED_COUNTER);
RetryPolicy retryPolicy = new RetryNTimes(ZK_RETRY_COUNT, zkConfig.getSleepBetweenRetriesMs());
// todo - consider making the retry until elapsed a separate config from the zk session timeout
RetryPolicy retryPolicy =
new RetryUntilElapsed(
zkConfig.getZkSessionTimeoutMs(), zkConfig.getSleepBetweenRetriesMs());

// TODO: In future add ZK auth credentials can be passed in here.
CuratorFramework curator =
Expand Down

0 comments on commit bfa3a76

Please sign in to comment.