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 14
14
worker = Resque ::Worker . new ( *queues )
15
15
worker . verbose = ENV [ 'LOGGING' ] || ENV [ 'VERBOSE' ]
16
16
worker . very_verbose = ENV [ 'VVERBOSE' ]
17
+ worker . term_timeout = ENV [ 'RESQUE_TERM_TIMEOUT' ] || 4.0
17
18
rescue Resque ::NoQueueError
18
19
abort "set QUEUE env var, e.g. $ QUEUE=critical,high rake resque:work"
19
20
end
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ class Worker
20
20
# Automatically set if a fork(2) fails.
21
21
attr_accessor :cant_fork
22
22
23
+ attr_accessor :term_timeout
24
+
23
25
attr_writer :to_s
24
26
25
27
# Returns an array of all worker objects.
@@ -307,7 +309,7 @@ def kill_child
307
309
unless Process . waitpid ( @child , Process ::WNOHANG )
308
310
log! "Sending TERM signal to child #{ @child } "
309
311
Process . kill ( "TERM" , @child )
310
- 50 . times do |i |
312
+ ( term_timeout . to_f * 10 ) . round . times do |i |
311
313
sleep ( 0.1 )
312
314
return if Process . waitpid ( @child , Process ::WNOHANG )
313
315
end
You can’t perform that action at this time.
0 commit comments