Skip to content

Commit

Permalink
Release ticker resources
Browse files Browse the repository at this point in the history
Signed-off-by: Matin Rahmanian <[email protected]>
  • Loading branch information
itsmatinx committed Apr 26, 2021
1 parent a9d8a05 commit 835651e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions health/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ func PeriodicChecker(check Checker, period time.Duration) Checker {
u := NewStatusUpdater()
go func() {
t := time.NewTicker(period)
defer t.Stop()
for {
<-t.C
u.Update(check.Check())
Expand All @@ -150,6 +151,7 @@ func PeriodicThresholdChecker(check Checker, period time.Duration, threshold int
tu := NewThresholdStatusUpdater(threshold)
go func() {
t := time.NewTicker(period)
defer t.Stop()
for {
<-t.C
tu.Update(check.Check())
Expand Down

0 comments on commit 835651e

Please sign in to comment.