mirror of
https://github.com/hibiken/asynq.git
synced 2025-08-28 00:11:48 +08:00
fix: Nil out handler reference after all workers have finished
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user