Skip to content

Commit

Permalink
metrics/influxdb: fix time ticker leaks (ethereum#26507)
Browse files Browse the repository at this point in the history
  • Loading branch information
ucwong authored and shekhirin committed Jun 6, 2023
1 parent f2b516a commit cfd1e24
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions metrics/influxdb/influxdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions metrics/influxdb/influxdbv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit cfd1e24

Please sign in to comment.