diff --git a/agent/agent.go b/agent/agent.go index 97c6b01c8..863309f28 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -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 { diff --git a/agent/agent_notwindows.go b/agent/agent_posix.go similarity index 78% rename from agent/agent_notwindows.go rename to agent/agent_posix.go index 4d1f496a9..09552cac0 100644 --- a/agent/agent_notwindows.go +++ b/agent/agent_posix.go @@ -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) } diff --git a/agent/agent_windows.go b/agent/agent_windows.go index 7e7a0cabd..94ed9d006 100644 --- a/agent/agent_windows.go +++ b/agent/agent_windows.go @@ -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 }