@@ -470,66 +470,6 @@ def self.perform
470470 assert_not_equal original_connection , Resque . redis . client . connection . instance_variable_get ( "@sock" )
471471 end
472472
473- if !defined? ( RUBY_ENGINE ) || defined? ( RUBY_ENGINE ) && RUBY_ENGINE != "jruby"
474- it "old signal handling is the default" do
475- rescue_time = nil
476-
477- begin
478- class LongRunningJob
479- @queue = :long_running_job
480-
481- def self . perform ( run_time , rescue_time = nil )
482- Resque . redis . client . reconnect # get its own connection
483- Resque . redis . rpush ( 'sigterm-test:start' , Process . pid )
484- sleep run_time
485- Resque . redis . rpush ( 'sigterm-test:result' , 'Finished Normally' )
486- rescue Resque ::TermException => e
487- Resque . redis . rpush ( 'sigterm-test:result' , %Q(Caught SignalException: #{ e . inspect } ) )
488- sleep rescue_time unless rescue_time . nil?
489- ensure
490- puts 'fuuuu'
491- Resque . redis . rpush ( 'sigterm-test:final' , 'exiting.' )
492- end
493- end
494-
495- Resque . enqueue ( LongRunningJob , 5 , rescue_time )
496-
497- worker_pid = Kernel . fork do
498- # ensure we actually fork
499- $TESTING = false
500- # reconnect since we just forked
501- Resque . redis . client . reconnect
502-
503- worker = Resque ::Worker . new ( :long_running_job )
504-
505- worker . work ( 0 )
506- exit!
507- end
508-
509- # ensure the worker is started
510- start_status = Resque . redis . blpop ( 'sigterm-test:start' , 5 )
511- assert_not_nil start_status
512- child_pid = start_status [ 1 ] . to_i
513- assert_operator child_pid , :> , 0
514-
515- # send signal to abort the worker
516- Process . kill ( 'TERM' , worker_pid )
517- Process . waitpid ( worker_pid )
518-
519- # wait to see how it all came down
520- result = Resque . redis . blpop ( 'sigterm-test:result' , 5 )
521- assert_nil result
522-
523- # ensure that the child pid is no longer running
524- child_still_running = !( `ps -p #{ child_pid . to_s } -o pid=` ) . empty?
525- assert !child_still_running
526- ensure
527- remaining_keys = Resque . redis . keys ( 'sigterm-test:*' ) || [ ]
528- Resque . redis . del ( *remaining_keys ) unless remaining_keys . empty?
529- end
530- end
531- end
532-
533473 if !defined? ( RUBY_ENGINE ) || defined? ( RUBY_ENGINE ) && RUBY_ENGINE != "jruby"
534474 [ SignalException , Resque ::TermException ] . each do |exception |
535475 {
@@ -565,7 +505,6 @@ def self.perform( run_time, rescue_time=nil )
565505
566506 worker = Resque ::Worker . new ( :long_running_job )
567507 worker . term_timeout = 1
568- worker . term_child = 1
569508
570509 worker . work ( 0 )
571510 exit!
0 commit comments