Skip to content

Commit

Permalink
fix: windows service - graceful shutdown of telegraf (influxdata#9616)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhychan authored and powersj committed Jan 21, 2022
1 parent 70479fa commit 7cc4364
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/telegraf/telegraf_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ func (p *program) run() {
p.inputFilters,
p.outputFilters,
)
close(stop)
}
func (p *program) Stop(s service.Service) error {
close(stop)
var empty struct{}
stop <- empty // signal reloadLoop to finish (context cancel)
<-stop // wait for reloadLoop to finish and close channel
return nil
}

Expand Down

0 comments on commit 7cc4364

Please sign in to comment.