@cryptotaxi247 / netdata-1 / commits / 9b3d9f3eb

fix(go.d): clean up charts for stopped and removed jobs (#19573)

Ilya Mashchenko committed Feb 4, 2025 at 16:08 UTC 9b3d9f3eb6b93f8041faca7ec90b6b321f0fab47
1 file changed +5 -2
src/go/plugin/go.d/agent/agent.go
+5 -2
@@ -104,7 +104,7 @@ func serve(a *Agent) {
104 var exit bool
105
106 for {
107 - module.ObsoleteCharts(false)
107 + module.ObsoleteCharts(true)
108
109 ctx, cancel := context.WithCancel(context.Background())
110
@@ -116,7 +116,6 @@ func serve(a *Agent) {
116 switch sig {
117 case syscall.SIGHUP:
118 a.Infof("received %s signal (%d). Restarting running instance", sig, sig)
119 - module.ObsoleteCharts(true)
119 default:
120 a.Infof("received %s signal (%d). Terminating...", sig, sig)
121 exit = true
@@ -126,6 +125,10 @@ func serve(a *Agent) {
125 exit = true
126 }
127
128 + if exit {
129 + module.ObsoleteCharts(false)
130 + }
131 +
132 cancel()
133
134 func() {