We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 82ea71c commit fd1d9aeCopy full SHA for fd1d9ae
lib/resque/worker.rb
@@ -299,12 +299,17 @@ def shutdown?
299
@shutdown
300
end
301
302
- # Kills the forked child immediately, without remorse. The job it
+ # Kills the forked child immediately with minimal remorse. The job it
303
# is processing will not be completed.
304
def kill_child
305
if @child
306
log! "Killing child at #{@child}"
307
if system("ps -o pid,state -p #{@child}")
308
+ Process.kill("TERM", @child) rescue nil
309
+ 10.times do
310
+ return unless system("ps -o pid,state -p #{@child}")
311
+ sleep(0.1)
312
+ end
313
Process.kill("KILL", @child) rescue nil
314
else
315
log! "Child #{@child} not found, restarting."
0 commit comments