Closed nulian closed 7 years ago
Hi there! Thanks for the report. I'm not sure I'm totally clear on the what you're describing. Do you have code to describe the scenario? Thanks!
If you shoot in like 10 jobs that take 1 sec a piece and the shutdown_timeout == 15. And immediately after the jobs got added the servers gets a shutdown command like using ctrl + c. The final job won't succeed because the thread lock job finishes faster then the last job that runs.
Happy to poke around if you want to provide a test script!
Still need to take some time to build a example project but found a solution for it myself. Replaced the comparable shutdown_all part with this below.
queue.post(latch) do |l|
while queue.busy_workers != 0 do
sleep(1)
end
l.count_down
end
end
When multiple workers are processing it could finish up before the timeout timer. The reason is because 1 worker can handle the latch.count_down while the other one is still processing.