File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,7 @@ def work(interval = 5.0, &block)
141
141
procline "Forked #{ @child } at #{ Time . now . to_i } "
142
142
Process . wait ( @child )
143
143
else
144
+ unregister_signal_handlers unless @cant_fork
144
145
procline "Processing #{ job . queue } since #{ Time . now . to_i } "
145
146
redis . client . reconnect # Don't share connection with parent
146
147
perform ( job , &block )
@@ -283,6 +284,18 @@ def register_signal_handlers
283
284
log! "Registered signals"
284
285
end
285
286
287
+ def unregister_signal_handlers
288
+ trap ( 'TERM' , 'DEFAULT' )
289
+ trap ( 'INT' , 'DEFAULT' )
290
+
291
+ begin
292
+ trap ( 'QUIT' , 'DEFAULT' )
293
+ trap ( 'USR1' , 'DEFAULT' )
294
+ trap ( 'USR2' , 'DEFAULT' )
295
+ rescue ArgumentError
296
+ end
297
+ end
298
+
286
299
# Schedule this worker for shutdown. Will finish processing the
287
300
# current job.
288
301
def shutdown
You can’t perform that action at this time.
0 commit comments