From 9c588ac992e21b11f303a03ee629998e2a2de71a Mon Sep 17 00:00:00 2001 From: Marco Pfatschbacher Date: Wed, 11 Jan 2023 12:00:10 +0100 Subject: [PATCH] Remove timout from sidecar shutdown routine We don't need a separate timeout here, because each runner is guaranteed to stop with their individual stop timeouts. --- daemon/distributor.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/daemon/distributor.go b/daemon/distributor.go index b3cde19..2b51dcd 100644 --- a/daemon/distributor.go +++ b/daemon/distributor.go @@ -49,20 +49,17 @@ func (dist *Distributor) Start(s service.Service) error { return nil } -// stop all backend runner parallel and wait till they are finished +// stop all backend runners in parallel and wait until they are finished func (dist *Distributor) Stop(s service.Service) error { log.Info("Stopping signal distributor") for _, runner := range Daemon.Runner { runner.Shutdown() } for _, runner := range Daemon.Runner { - limit := 100 - for timeout := 0; runner.Running() && timeout < limit; timeout++ { + for runner.Running() { + log.Debugf("[%s] Waiting for runner to finish", runner.Name()) time.Sleep(100 * time.Millisecond) } - if runner.Running() { - log.Warnf("[%s] collector failed to exit", runner.Name()) - } } dist.Running = false