mirror of
https://github.com/hibiken/asynq.git
synced 2026-02-05 09:36:53 +00:00
Use sync.WaitGroup for shutdown
This commit is contained in:
@@ -119,11 +119,13 @@ func (p *processor) terminate() {
|
||||
p.restore() // move any unfinished tasks back to the queue.
|
||||
}
|
||||
|
||||
func (p *processor) start() {
|
||||
func (p *processor) start(wg *sync.WaitGroup) {
|
||||
// NOTE: The call to "restore" needs to complete before starting
|
||||
// the processor goroutine.
|
||||
p.restore()
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for {
|
||||
select {
|
||||
case <-p.done:
|
||||
|
||||
Reference in New Issue
Block a user