Skip to content

Commit

Permalink
Close running outputs when reloading (influxdata#8769)
Browse files Browse the repository at this point in the history
  • Loading branch information
viperstars authored Mar 16, 2021
1 parent 89f5e8a commit 71757e8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,13 @@ func stopServiceInputs(inputs []*models.RunningInput) {
}
}

// stopRunningOutputs stops all running outputs.
func stopRunningOutputs(outputs []*models.RunningOutput) {
for _, output := range outputs {
output.Close()
}
}

// gather runs an input's gather function periodically until the context is
// done.
func (a *Agent) gatherLoop(
Expand Down Expand Up @@ -784,6 +791,9 @@ func (a *Agent) runOutputs(
cancel()
wg.Wait()

log.Println("I! [agent] Stopping running outputs")
stopRunningOutputs(unit.outputs)

return nil
}

Expand Down

0 comments on commit 71757e8

Please sign in to comment.