From 297ec0669d204f9df0558eb6e6e78626b8d3e9b1 Mon Sep 17 00:00:00 2001 From: ucwong Date: Tue, 17 Jan 2023 06:45:35 -0600 Subject: [PATCH] metrics/influxdb: fix time ticker leaks (#26507) --- metrics/influxdb/influxdb.go | 3 +++ metrics/influxdb/influxdbv2.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/metrics/influxdb/influxdb.go b/metrics/influxdb/influxdb.go index 1bf0c355e..748c692e1 100644 --- a/metrics/influxdb/influxdb.go +++ b/metrics/influxdb/influxdb.go @@ -101,6 +101,9 @@ func (r *reporter) run() { intervalTicker := time.NewTicker(r.interval) pingTicker := time.NewTicker(time.Second * 5) + defer intervalTicker.Stop() + defer pingTicker.Stop() + for { select { case <-intervalTicker.C: diff --git a/metrics/influxdb/influxdbv2.go b/metrics/influxdb/influxdbv2.go index dc4c04fae..bfb762196 100644 --- a/metrics/influxdb/influxdbv2.go +++ b/metrics/influxdb/influxdbv2.go @@ -62,6 +62,9 @@ func (r *v2Reporter) run() { intervalTicker := time.NewTicker(r.interval) pingTicker := time.NewTicker(time.Second * 5) + defer intervalTicker.Stop() + defer pingTicker.Stop() + for { select { case <-intervalTicker.C: