mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-03 18:53:13 -05:00 
			
		
		
		
	plugin/etcd: fix etcd connection leakage when reload (#6646)
Signed-off-by: zhongyuanjun <zhongyuanjun@bytedance.com> Co-authored-by: zhongyuanjun <zhongyuanjun@bytedance.com>
This commit is contained in:
		@@ -183,3 +183,11 @@ func (e *Etcd) TTL(kv *mvccpb.KeyValue, serv *msg.Service) uint32 {
 | 
			
		||||
func shouldInclude(serv *msg.Service, qType uint16) bool {
 | 
			
		||||
	return (qType == dns.TypeTXT && serv.Text != "") || serv.Host != ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// OnShutdown shuts down etcd client when caddy instance restart
 | 
			
		||||
func (e *Etcd) OnShutdown() error {
 | 
			
		||||
	if e.Client != nil {
 | 
			
		||||
		e.Client.Close()
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user