discovery: don't log errors on context cancelation

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
pull/6116/head
Simon Pasquier 5 years ago
parent 0f022aa42b
commit 8ec6f02854

@ -128,7 +128,9 @@ func (e *Endpoints) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
defer e.queue.ShutDown()
if !cache.WaitForCacheSync(ctx.Done(), e.endpointsInf.HasSynced, e.serviceInf.HasSynced, e.podInf.HasSynced) {
level.Error(e.logger).Log("msg", "endpoints informer unable to sync cache")
if ctx.Err() != context.Canceled {
level.Error(e.logger).Log("msg", "endpoints informer unable to sync cache")
}
return
}

@ -70,7 +70,9 @@ func (i *Ingress) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
defer i.queue.ShutDown()
if !cache.WaitForCacheSync(ctx.Done(), i.informer.HasSynced) {
level.Error(i.logger).Log("msg", "ingress informer unable to sync cache")
if ctx.Err() != context.Canceled {
level.Error(i.logger).Log("msg", "ingress informer unable to sync cache")
}
return
}

@ -79,7 +79,9 @@ func (n *Node) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
defer n.queue.ShutDown()
if !cache.WaitForCacheSync(ctx.Done(), n.informer.HasSynced) {
level.Error(n.logger).Log("msg", "node informer unable to sync cache")
if ctx.Err() != context.Canceled {
level.Error(n.logger).Log("msg", "node informer unable to sync cache")
}
return
}

@ -82,7 +82,9 @@ func (p *Pod) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
defer p.queue.ShutDown()
if !cache.WaitForCacheSync(ctx.Done(), p.informer.HasSynced) {
level.Error(p.logger).Log("msg", "pod informer unable to sync cache")
if ctx.Err() != context.Canceled {
level.Error(p.logger).Log("msg", "pod informer unable to sync cache")
}
return
}

@ -75,7 +75,9 @@ func (s *Service) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
defer s.queue.ShutDown()
if !cache.WaitForCacheSync(ctx.Done(), s.informer.HasSynced) {
level.Error(s.logger).Log("msg", "service informer unable to sync cache")
if ctx.Err() != context.Canceled {
level.Error(s.logger).Log("msg", "service informer unable to sync cache")
}
return
}

@ -75,7 +75,9 @@ func (d *Discovery) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
// Get an initial set right away.
tgs, err := d.refresh(ctx)
if err != nil {
level.Error(d.logger).Log("msg", "Unable to refresh target groups", "err", err.Error())
if ctx.Err() != context.Canceled {
level.Error(d.logger).Log("msg", "Unable to refresh target groups", "err", err.Error())
}
} else {
select {
case ch <- tgs:
@ -92,7 +94,9 @@ func (d *Discovery) Run(ctx context.Context, ch chan<- []*targetgroup.Group) {
case <-ticker.C:
tgs, err := d.refresh(ctx)
if err != nil {
level.Error(d.logger).Log("msg", "Unable to refresh target groups", "err", err.Error())
if ctx.Err() != context.Canceled {
level.Error(d.logger).Log("msg", "Unable to refresh target groups", "err", err.Error())
}
continue
}

Loading…
Cancel
Save