Prevent data race in purger

This commit is contained in:
alitto
2020-03-31 11:39:15 -03:00
parent fe941f526b
commit 9648c3ec66
+4 -3
View File
@@ -243,9 +243,6 @@ func (p *WorkerPool) dispatch() {
batch = nil
}
// Send signal to stop all workers
close(p.dispatchedTasks)
// Send signal to stop the purger
close(p.purgerQuit)
}
@@ -269,6 +266,10 @@ func (p *WorkerPool) purge() {
// Received the signal to exit
case <-p.purgerQuit:
// Send signal to stop all workers
close(p.dispatchedTasks)
return
}
}