go-zero
go-zero copied to clipboard
program exit, if registry use etcd, client must unregistry etcd before program exit
如果使用etcd注册服务, 在程序退出前,应该主动unregistry etcd(取消服务注册),不应该等etcd center 租约超时
publisher.go -> doKeepAlive()
// 多处使用这种方式,导制退出没有取消服务注册
case <-p.quit.Done():
return nil
// 可以增加一个服务反注册,取rpc注册服务更合理,同时client也可以更早的发现某个服务下线
Check the code here.
https://github.com/zeromicro/go-zero/blob/896e1a2abb09254ec37952869e40b2eeee5f0200/core/discov/publisher.go#L149
This issue is stale because it has been open for 30 days with no activity.