Close of reportTicker to exit goroutine.

This commit is contained in:
Johannes 'fish' Ziemke 2013-04-25 13:04:45 +02:00
parent 5043c6fce7
commit 22da76e8ab

View file

@ -164,20 +164,13 @@ func (t *tieredStorage) Serve() {
var (
flushMemoryTicker = time.Tick(t.flushMemoryInterval)
writeMemoryTicker = time.Tick(t.writeMemoryInterval)
stopReport = make(chan bool)
reportTicker = time.NewTicker(time.Second)
)
defer func() { close(stopReport) }()
defer reportTicker.Stop()
go func() {
reportTicker := time.Tick(time.Second)
for {
select {
case <-reportTicker:
t.reportQueues()
case <-stopReport:
return
}
for _ = range reportTicker.C {
t.reportQueues()
}
}()