Close running outputs when reloading (#8769)
This commit is contained in:
parent
89f5e8a9d9
commit
71757e8039
|
|
@ -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
|
// gather runs an input's gather function periodically until the context is
|
||||||
// done.
|
// done.
|
||||||
func (a *Agent) gatherLoop(
|
func (a *Agent) gatherLoop(
|
||||||
|
|
@ -784,6 +791,9 @@ func (a *Agent) runOutputs(
|
||||||
cancel()
|
cancel()
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
|
log.Println("I! [agent] Stopping running outputs")
|
||||||
|
stopRunningOutputs(unit.outputs)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue