metrics/influxdb: fix time ticker leaks (#26507)

This commit is contained in:
ucwong 2023-01-17 06:45:35 -06:00 committed by GitHub
parent f2758a8dac
commit 297ec0669d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -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:

View File

@ -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: