Merge pull request #64 from inf-rno/master

Fix janitor stop channel data race
This commit is contained in:
Patrick Mylund Nielsen 2017-07-22 00:01:10 -04:00 committed by GitHub
commit a3647f8e31
1 changed files with 1 additions and 1 deletions

View File

@ -1074,7 +1074,6 @@ type janitor struct {
}
func (j *janitor) Run(c *cache) {
j.stop = make(chan bool)
ticker := time.NewTicker(j.Interval)
for {
select {
@ -1094,6 +1093,7 @@ func stopJanitor(c *Cache) {
func runJanitor(c *cache, ci time.Duration) {
j := &janitor{
Interval: ci,
stop: make(chan bool),
}
c.janitor = j
go j.Run(c)