Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eureka.client.initial-instance-info-replication-interval-seconds with initial delay can not take effect bug #4109

Open
irwinai opened this issue Jul 27, 2022 · 0 comments
Assignees
Labels

Comments

@irwinai
Copy link

irwinai commented Jul 27, 2022

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants