do not leak Ticker in closed stats reporter
parent
a4ea44acb1
commit
7e57c6047b
|
@ -103,16 +103,18 @@ func NewStatsReporterWithEstimate(counts *ElementCounts) *Statistics {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Statistics) loop() {
|
func (s *Statistics) loop() {
|
||||||
tick := time.Tick(500 * time.Millisecond)
|
tick := time.NewTicker(500 * time.Millisecond)
|
||||||
tock := time.Tick(time.Minute)
|
tock := time.NewTicker(time.Minute)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-s.done:
|
case <-s.done:
|
||||||
|
tick.Stop()
|
||||||
|
tock.Stop()
|
||||||
s.counter.PrintStats()
|
s.counter.PrintStats()
|
||||||
return
|
return
|
||||||
case <-tock:
|
case <-tock.C:
|
||||||
s.counter.PrintStats()
|
s.counter.PrintStats()
|
||||||
case <-tick:
|
case <-tick.C:
|
||||||
s.counter.PrintTick()
|
s.counter.PrintTick()
|
||||||
s.counter.Tick()
|
s.counter.Tick()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue