fix issue with closing flush signal channel (#7384)

This commit is contained in:
Steven Soroka 2020-04-21 13:33:47 -04:00 committed by GitHub
parent a4eb9c2205
commit 050ed9e61e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -556,6 +556,7 @@ func (a *Agent) flushLoop(
// watch for flush requests
flushRequested := make(chan os.Signal, 1)
watchForFlushSignal(flushRequested)
defer stopListeningForFlushSignal(flushRequested)
// align to round interval
if a.Config.Agent.RoundInterval {

View File

@ -12,5 +12,8 @@ const flushSignal = syscall.SIGUSR1
func watchForFlushSignal(flushRequested chan os.Signal) {
signal.Notify(flushRequested, flushSignal)
}
func stopListeningForFlushSignal(flushRequested chan os.Signal) {
defer signal.Stop(flushRequested)
}

View File

@ -5,5 +5,9 @@ package agent
import "os"
func watchForFlushSignal(flushRequested chan os.Signal) {
// not implemented
// not supported
}
func stopListeningForFlushSignal(flushRequested chan os.Signal) {
// not supported
}