Commit 68e09f00 authored by Chris O'Haver's avatar Chris O'Haver Committed by John Belamaric

skip pushing watch updates when there are no watches (#2513)

parent 0eff7f37
...@@ -96,10 +96,16 @@ func (dns *dnsControl) sendUpdates(oldObj, newObj interface{}) { ...@@ -96,10 +96,16 @@ func (dns *dnsControl) sendUpdates(oldObj, newObj interface{}) {
switch ob := obj.(type) { switch ob := obj.(type) {
case *object.Service: case *object.Service:
dns.updateModifed() dns.updateModifed()
if len(dns.watched) == 0 {
return
}
dns.sendServiceUpdates(ob) dns.sendServiceUpdates(ob)
case *object.Endpoints: case *object.Endpoints:
if newObj == nil || oldObj == nil { if newObj == nil || oldObj == nil {
dns.updateModifed() dns.updateModifed()
if len(dns.watched) == 0 {
return
}
dns.sendEndpointsUpdates(ob) dns.sendEndpointsUpdates(ob)
return return
} }
...@@ -109,9 +115,15 @@ func (dns *dnsControl) sendUpdates(oldObj, newObj interface{}) { ...@@ -109,9 +115,15 @@ func (dns *dnsControl) sendUpdates(oldObj, newObj interface{}) {
return return
} }
dns.updateModifed() dns.updateModifed()
if len(dns.watched) == 0 {
return
}
dns.sendEndpointsUpdates(endpointsSubsetDiffs(p, ob)) dns.sendEndpointsUpdates(endpointsSubsetDiffs(p, ob))
case *object.Pod: case *object.Pod:
dns.updateModifed() dns.updateModifed()
if len(dns.watched) == 0 {
return
}
dns.sendPodUpdates(ob) dns.sendPodUpdates(ob)
default: default:
log.Warningf("Updates for %T not supported.", ob) log.Warningf("Updates for %T not supported.", ob)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment