-
Notifications
You must be signed in to change notification settings - Fork 8.5k
feat: Springboot supports graceful shutdown of Nacos #3963
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
Conversation
单测失败了,可以修复下? |
看样子是cicd下载依赖出问题了? |
ok, 我来重试下 |
看样子是 action/cache 失败了,但是很奇怪,为什么失败了?👀👀 |
可以改的,最新版本似乎是 v4, https://github.com/actions/cache |
|
@yuluo-yx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
@EventListener(ContextClosedEvent.class)
public void onContextClosedEvent(ContextClosedEvent event) {
NacosDiscoveryProperties configuration = (NacosDiscoveryProperties) getConfiguration();
Integer gracefulShutdownWaitTime = configuration.getGracefulShutdownWaitTime();
ThreadUtils.sleep(gracefulShutdownWaitTime);
stop();
} 请问一下,为什么sleep在stop()之前? |
经过测试,这段代码might be写错了。 |
遇到的问题
发版期间,springboot 是先拒绝请求,再下线nacos注册的实例,导致gateway有部分流量打到服务,服务会拒绝请求
@PreDestroy public void destroy() { stop(); }
这是目前的关机逻辑,这个钩子会在springweb拒绝请求后再执行
解决办法
目前生产环境测试发版不会抖动