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

注册的服务下线了不是实时更新的吗 #177

Open
a34546 opened this issue May 6, 2024 · 5 comments
Open

注册的服务下线了不是实时更新的吗 #177

a34546 opened this issue May 6, 2024 · 5 comments

Comments

@a34546
Copy link

a34546 commented May 6, 2024

最近在用AgileConfig服务注册发现对接网关,测试下来,服务上线会实时注册,服务下线后,配置中心的服务还是在线的,没有实时触发服务下线,会导致网关该节点还是正常在线的。我希望能及时知道服务上下线,然后去动态加载网关数据。有办法实时知道服务下线吗?

@a34546
Copy link
Author

a34546 commented May 7, 2024

目前在服务停止时,主动断开连接,可以做到实时
app.Services.GetRequiredService().ApplicationStopping.Register(async () =>
{
await ConfigClient.Instance.DisconnectAsync();
});

@kklldog
Copy link
Collaborator

kklldog commented May 7, 2024

按理是不需要的,正常关闭程序应该会触发Stop方法。https://github.com/kklldog/AgileConfig_Client/blob/ea66641f9175f30517ea5f45e0391f546ca81194/AgileConfig.Client/RegisterCenter/RegisterHostedService.cs#L40
控制台直接X掉好像不会触发该方法,所以不会实时下线。会等待30s心跳没回复后自动下线。

@a34546
Copy link
Author

a34546 commented May 7, 2024

哦,那之前应该是我手动X掉控制台导致的没有及时更新.

@a34546
Copy link
Author

a34546 commented May 7, 2024

等待30s心跳,这个可以配置吗?我想设置短一点

@kklldog
Copy link
Collaborator

kklldog commented May 7, 2024

"serviceHealthCheckInterval": 15, // 服务健康检测的间隔时间,单位:秒
"serviceUnhealthInterval": 30, // 判断服务不健康的间隔,超出这个时间没响应过则认为不健康,单位:秒

这2个参数你调小一点

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants