fix issue with closing flush signal channel (#7384)
This commit is contained in:
parent
a4eb9c2205
commit
050ed9e61e
|
@ -556,6 +556,7 @@ func (a *Agent) flushLoop(
|
||||||
// watch for flush requests
|
// watch for flush requests
|
||||||
flushRequested := make(chan os.Signal, 1)
|
flushRequested := make(chan os.Signal, 1)
|
||||||
watchForFlushSignal(flushRequested)
|
watchForFlushSignal(flushRequested)
|
||||||
|
defer stopListeningForFlushSignal(flushRequested)
|
||||||
|
|
||||||
// align to round interval
|
// align to round interval
|
||||||
if a.Config.Agent.RoundInterval {
|
if a.Config.Agent.RoundInterval {
|
||||||
|
|
|
@ -12,5 +12,8 @@ const flushSignal = syscall.SIGUSR1
|
||||||
|
|
||||||
func watchForFlushSignal(flushRequested chan os.Signal) {
|
func watchForFlushSignal(flushRequested chan os.Signal) {
|
||||||
signal.Notify(flushRequested, flushSignal)
|
signal.Notify(flushRequested, flushSignal)
|
||||||
|
}
|
||||||
|
|
||||||
|
func stopListeningForFlushSignal(flushRequested chan os.Signal) {
|
||||||
defer signal.Stop(flushRequested)
|
defer signal.Stop(flushRequested)
|
||||||
}
|
}
|
|
@ -5,5 +5,9 @@ package agent
|
||||||
import "os"
|
import "os"
|
||||||
|
|
||||||
func watchForFlushSignal(flushRequested chan os.Signal) {
|
func watchForFlushSignal(flushRequested chan os.Signal) {
|
||||||
// not implemented
|
// not supported
|
||||||
|
}
|
||||||
|
|
||||||
|
func stopListeningForFlushSignal(flushRequested chan os.Signal) {
|
||||||
|
// not supported
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue