From b96bece193158bb2a014648a497e9c8ca94e0a4d Mon Sep 17 00:00:00 2001 From: anim001k <140460766+anim001k@users.noreply.github.com> Date: Fri, 3 Oct 2025 10:02:21 +0200 Subject: [PATCH] Update opentsdb.go --- metrics/opentsdb.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/metrics/opentsdb.go b/metrics/opentsdb.go index 57af3d025e..12ea63ba86 100644 --- a/metrics/opentsdb.go +++ b/metrics/opentsdb.go @@ -39,7 +39,9 @@ func OpenTSDB(r Registry, d time.Duration, prefix string, addr *net.TCPAddr) { // OpenTSDBWithConfig is a blocking exporter function just like OpenTSDB, // but it takes a OpenTSDBConfig instead. func OpenTSDBWithConfig(c OpenTSDBConfig) { - for range time.Tick(c.FlushInterval) { + ticker := time.NewTicker(c.FlushInterval) + defer ticker.Stop() // Use NewTicker to allow explicit stop and avoid leaked timers. + for range ticker.C { if err := openTSDB(&c); nil != err { log.Println(err) }