Skip to content

Commit

Permalink
fix: windows service - graceful shutdown of telegraf (#9616)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhychan committed Dec 2, 2021
1 parent 75c48d4 commit b954e56
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 b954e56

Please sign in to comment.