File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change 1414 worker = Resque ::Worker . new ( *queues )
1515 worker . verbose = ENV [ 'LOGGING' ] || ENV [ 'VERBOSE' ]
1616 worker . very_verbose = ENV [ 'VVERBOSE' ]
17+ worker . term_timeout = ENV [ 'RESQUE_TERM_TIMEOUT' ] || 4.0
1718 rescue Resque ::NoQueueError
1819 abort "set QUEUE env var, e.g. $ QUEUE=critical,high rake resque:work"
1920 end
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ class Worker
2020 # Automatically set if a fork(2) fails.
2121 attr_accessor :cant_fork
2222
23+ attr_accessor :term_timeout
24+
2325 attr_writer :to_s
2426
2527 # Returns an array of all worker objects.
@@ -307,7 +309,7 @@ def kill_child
307309 unless Process . waitpid ( @child , Process ::WNOHANG )
308310 log! "Sending TERM signal to child #{ @child } "
309311 Process . kill ( "TERM" , @child )
310- 50 . times do |i |
312+ ( term_timeout . to_f * 10 ) . round . times do |i |
311313 sleep ( 0.1 )
312314 return if Process . waitpid ( @child , Process ::WNOHANG )
313315 end
You can’t perform that action at this time.
0 commit comments