Prevent data race in purger
This commit is contained in:
@@ -243,9 +243,6 @@ func (p *WorkerPool) dispatch() {
|
|||||||
batch = nil
|
batch = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send signal to stop all workers
|
|
||||||
close(p.dispatchedTasks)
|
|
||||||
|
|
||||||
// Send signal to stop the purger
|
// Send signal to stop the purger
|
||||||
close(p.purgerQuit)
|
close(p.purgerQuit)
|
||||||
}
|
}
|
||||||
@@ -269,6 +266,10 @@ func (p *WorkerPool) purge() {
|
|||||||
|
|
||||||
// Received the signal to exit
|
// Received the signal to exit
|
||||||
case <-p.purgerQuit:
|
case <-p.purgerQuit:
|
||||||
|
|
||||||
|
// Send signal to stop all workers
|
||||||
|
close(p.dispatchedTasks)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user