mirror of
https://github.com/hibiken/asynq.git
synced 2024-12-25 23:32:17 +08:00
fix: Nil out handler reference after all workers have finished
This commit is contained in:
parent
ac3190a0d5
commit
5eaf606a0d
@ -55,6 +55,7 @@ func (bg *Background) start(handler TaskHandler) {
|
|||||||
if bg.running {
|
if bg.running {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
bg.running = true
|
bg.running = true
|
||||||
bg.processor.handler = handler
|
bg.processor.handler = handler
|
||||||
|
|
||||||
@ -69,9 +70,10 @@ func (bg *Background) stop() {
|
|||||||
if !bg.running {
|
if !bg.running {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
bg.running = false
|
|
||||||
bg.processor.handler = nil
|
|
||||||
|
|
||||||
bg.poller.terminate()
|
bg.poller.terminate()
|
||||||
bg.processor.terminate()
|
bg.processor.terminate()
|
||||||
|
|
||||||
|
bg.processor.handler = nil
|
||||||
|
bg.running = false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user