-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
为什么配置自动刷新功能,client端会请求两次server端获取content #2230
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
springCloudAlibaba2.2.6 版本 nacos-client2.0.2 nacos-server 2.0.2
问题描述:
nacos配置中心,自动刷新配置的功能,在nacos管理界面修改相关应用配置,nacos-clinet最终会请求两次server获取具体的修改细节。确实不是nacos-client的原生逻辑,发送事件给spring的逻辑在nacos-config starter里面的NacosContextRefresher类。最后spring那边处理的过程中会重新生成上下文,在这个过程中就调用到了nacosConfigService的getConfig方法,又请求了一次server(也就是第二次请求server)
意见:因为第一次请求之后就已经将修改配置的细节存放到CacheData的content里面了,这里spring调用getConfig方法的时候是否可以直接拿CacheData 里面的content,我是觉得这里需要优化一下吧,因为本来就只需要请求一次server的。
下面是从第一次请求server到第二次请求server 代码的一个执行顺序:
第一次请求server
发布refresh事件
第二次请求server
The text was updated successfully, but these errors were encountered: