go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

program exit, if registry use etcd, client must unregistry etcd before program exit

Open Owen-Zhang opened this issue 1 year ago • 1 comments

如果使用etcd注册服务, 在程序退出前,应该主动unregistry etcd(取消服务注册),不应该等etcd center 租约超时

publisher.go -> doKeepAlive() 

// 多处使用这种方式,导制退出没有取消服务注册
case <-p.quit.Done():
	return nil

// 可以增加一个服务反注册,取rpc注册服务更合理,同时client也可以更早的发现某个服务下线

Owen-Zhang avatar Jul 24 '24 09:07 Owen-Zhang

Check the code here.

https://github.com/zeromicro/go-zero/blob/896e1a2abb09254ec37952869e40b2eeee5f0200/core/discov/publisher.go#L149

kevwan avatar Aug 27 '24 14:08 kevwan

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Aug 29 '25 02:08 github-actions[bot]