metrics/influxdb: fix time ticker leaks (#26507)
This commit is contained in:
parent
f2758a8dac
commit
297ec0669d
@ -101,6 +101,9 @@ func (r *reporter) run() {
|
|||||||
intervalTicker := time.NewTicker(r.interval)
|
intervalTicker := time.NewTicker(r.interval)
|
||||||
pingTicker := time.NewTicker(time.Second * 5)
|
pingTicker := time.NewTicker(time.Second * 5)
|
||||||
|
|
||||||
|
defer intervalTicker.Stop()
|
||||||
|
defer pingTicker.Stop()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-intervalTicker.C:
|
case <-intervalTicker.C:
|
||||||
|
@ -62,6 +62,9 @@ func (r *v2Reporter) run() {
|
|||||||
intervalTicker := time.NewTicker(r.interval)
|
intervalTicker := time.NewTicker(r.interval)
|
||||||
pingTicker := time.NewTicker(time.Second * 5)
|
pingTicker := time.NewTicker(time.Second * 5)
|
||||||
|
|
||||||
|
defer intervalTicker.Stop()
|
||||||
|
defer pingTicker.Stop()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-intervalTicker.C:
|
case <-intervalTicker.C:
|
||||||
|
Loading…
Reference in New Issue
Block a user