Skip to content

Commit

Permalink
Remove timout from sidecar shutdown routine
Browse files Browse the repository at this point in the history
We don't need a separate timeout here, because
each runner is guaranteed to stop with their individual stop timeouts.
  • Loading branch information
mpfz0r committed Jan 11, 2023
1 parent cb9b378 commit 9c588ac
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions daemon/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 9c588ac

Please sign in to comment.