sm
/
cache
1
0
Fork 0

Merge pull request #23 from databus23/patch-1

Fix leaking the janitor ticker when shutting down
This commit is contained in:
Patrick Mylund Nielsen 2015-10-13 08:21:26 -04:00
commit a122e14c4b
1 changed files with 3 additions and 2 deletions

View File

@ -941,12 +941,13 @@ type janitor struct {
func (j *janitor) Run(c *cache) {
j.stop = make(chan bool)
tick := time.Tick(j.Interval)
ticker := time.NewTicker(j.Interval)
for {
select {
case <-tick:
case <-ticker.C:
c.DeleteExpired()
case <-j.stop:
ticker.Stop()
return
}
}