lhotari commented on code in PR #23230:
URL: https://github.com/apache/pulsar/pull/23230#discussion_r1735538539
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImpl.java:
##########
@@ -401,10 +404,33 @@ public void start() throws PulsarServerException {
this.serviceUnitStateChannel.listen(splitManager);
this.leaderElectionService.start();
pulsar.runWhenReadyForIncomingRequests(() -> {
- try {
- this.serviceUnitStateChannel.start();
- } catch (Exception e) {
- failStarting(e);
+ int retry = 0;
+ while (!Thread.currentThread().isInterrupted()) {
+ try {
+ brokerRegistry.register();
+ this.serviceUnitStateChannel.start();
+ break;
+ } catch (Exception e) {
+ log.warn("The broker:{} failed to start service unit
state channel. Retrying {} th ...",
+ pulsar.getBrokerId(), ++retry, e);
+ try {
+ TimeUnit.SECONDS.sleep(Math.min(retry * 10L,
MAX_ROLE_CHANGE_RETRY_DELAY_IN_MILLIS));
Review Comment:
There's currently the org.apache.pulsar.common.util.Backoff class for doing
exponential backoff with jitter. I think it would be better to use that
solution instead of adding another way to do backoffs unless there's a specific
reason for this logic.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]