Release ticker resources
Signed-off-by: Matin Rahmanian <itsmatinx@gmail.com>
This commit is contained in:
parent
a9d8a05d08
commit
835651e513
@ -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())
|
||||
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user