add a schedule task to update namesrv address (#4456)

Co-authored-by: dengzhiwen1 <dengzhiwen1@xiaomi.com>
This commit is contained in:
cserwen
2022-06-14 09:42:39 +08:00
committed by GitHub
co-authored by dengzhiwen1
parent f08c79ff9f
commit b62d3b2fdb
@@ -401,6 +401,13 @@ public class BrokerController {
if (this.brokerConfig.getNamesrvAddr() != null) {
this.brokerOuterAPI.updateNameServerAddressList(this.brokerConfig.getNamesrvAddr());
log.info("Set user specified name server address: {}", this.brokerConfig.getNamesrvAddr());
this.scheduledExecutorService.scheduleAtFixedRate(() -> {
try {
BrokerController.this.brokerOuterAPI.updateNameServerAddressList(BrokerController.this.brokerConfig.getNamesrvAddr());
} catch (Throwable e) {
log.error("ScheduledTask updateNameServerAddr exception", e);
}
}, 1000 * 10, 1000 * 60 * 2, TimeUnit.MILLISECONDS);
} else if (this.brokerConfig.isFetchNamesrvAddrByAddressServer()) {
this.scheduledExecutorService.scheduleAtFixedRate(() -> {
try {