spring-cloud / spring-cloud/spring-cloud-netflix
eureka.client.initial-instance-info-replication-interval-seconds with initial delay can not take effect bug
@OlgaMaciaszek is already working on this.
Since Sep 1, 2022.
- Dominant language
- Java
- Stars
- 5k
- Forks
- 2.5k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 10
Description
Describe the bug
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.
Sample
eureka.client.initial-instance-info-replication-interval-seconds=99999
eureka.client.instance-info-replication-interval-seconds=88888
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.