Spring Boot Version: 2.7.2 || 1.9.8
Hello, team
When I want to use the eureka delay initial function, I found that is not effect in the case.
such as I set the property:eureka.client.initial-instance-info-replication-interval-seconds=100
But, in the EurekaServiceRegistry -- register function, used the setInstanceStatus to update initial status
@Override
public void register(EurekaRegistration reg) {
maybeInitializeClient(reg);
if (log.isInfoEnabled()) {
log.info("Registering application "
+ reg.getApplicationInfoManager().getInfo().getAppName()
+ " with eureka with status "
+ reg.getInstanceConfig().getInitialStatus());
}
reg.getApplicationInfoManager()
.setInstanceStatus(reg.getInstanceConfig().getInitialStatus());
reg.getHealthCheckHandler().ifAvailable(healthCheckHandler -> reg
.getEurekaClient().registerHealthCheck(healthCheckHandler));
}
and then will trigger StatusChangeEvent.
So, DiscoveryClient will be goto instanceInfoReplicator.onDemandUpdate() to register client to Eureka Server.
statusChangeListener = new ApplicationInfoManager.StatusChangeListener() {
@Override
public String getId() {
return "statusChangeListener";
}
@Override
public void notify(StatusChangeEvent statusChangeEvent) {
if (InstanceStatus.DOWN == statusChangeEvent.getStatus() ||
InstanceStatus.DOWN == statusChangeEvent.getPreviousStatus()) {
// log at warn level if DOWN was involved
logger.warn("Saw local status change event {}", statusChangeEvent);
} else {
logger.info("Saw local status change event {}", statusChangeEvent);
}
instanceInfoReplicator.onDemandUpdate();
}
};
if (clientConfig.shouldOnDemandUpdateStatusChange()) {
applicationInfoManager.registerStatusChangeListener(statusChangeListener);
}
At last, the eureka.client.initial-instance-info-replication-interval-seconds can not take effect.
Comment From: bclozel
I guess this was meant to be opened against spring-cloud-netflix? This doesn't seem to be a Spring Boot issue, so I'm closing it. Thanks!