Changeset 270
- Timestamp:
- 12/13/07 07:39:41 (8 months ago)
- Files:
-
- trunk/lib/backgroundrb.rb (modified) (9 diffs)
- trunk/lib/bdrb_conn_error.rb (added)
- trunk/server/meta_worker.rb (modified) (1 diff)
- trunk/test/backgroundrb_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/backgroundrb.rb
r252 r270 5 5 require File.dirname(__FILE__) + "/../framework/bin_parser" 6 6 require File.dirname(__FILE__) + "/../framework/nbio" 7 require "bdrb_conn_error" 7 8 8 9 module BackgrounDRb … … 27 28 @connection_status = true 28 29 rescue Timeout::Error 29 puts $!30 puts $!.backtrace31 30 @connection_status = false 32 31 rescue Exception => e 33 puts $!34 puts $!.backtrace35 32 @connection_status = false 36 33 end … … 40 37 p_data[:type] = :do_work 41 38 establish_connection() 42 raise "Error connecting to master process" unless @connection_status 39 p @connection_status 40 raise BackgrounDRb::BdrbConnError.new("Not able to connect") unless @connection_status 43 41 dump_object(p_data,@connection) 44 42 # @connection.close … … 48 46 p_data[:type] = :start_worker 49 47 establish_connection 50 raise "Error connecting to master process"unless @connection_status48 raise BackgrounDRb::BdrbConnError.new("Not able to connect") unless @connection_status 51 49 dump_object(p_data,@connection) 52 50 # @connection.close … … 56 54 p_data[:type] = :delete_worker 57 55 establish_connection 58 raise "Error connecting to master process"unless @connection_status56 raise BackgrounDRb::BdrbConnError.new("Not able to connect") unless @connection_status 59 57 dump_object(p_data,@connection) 60 58 # @connection.close … … 76 74 @tokenizer.extract(sock_data) { |b_data| return b_data } 77 75 rescue 78 raise "Error reading from master"76 raise BackgrounDRb::BdrbConnError.new("Not able to connect") 79 77 end 80 78 end … … 84 82 p_data[:type] = :all_worker_status 85 83 establish_connection 86 raise "Err connecting to master process"unless @connection_status84 raise BackgrounDRb::BdrbConnError.new("Not able to connect") unless @connection_status 87 85 dump_object(p_data,@connection) 88 86 begin … … 108 106 establish_connection() 109 107 110 raise "Err connecting to master process"unless @connection_status108 raise BackgrounDRb::BdrbConnError.new("Not able to connect") unless @connection_status 111 109 dump_object(p_data,@connection) 112 110 begin … … 132 130 establish_connection() 133 131 134 raise "Err connecting to master process"unless @connection_status132 raise BackgrounDRb::BdrbConnError.new("Not able to connect") unless @connection_status 135 133 dump_object(p_data,@connection) 136 134 begin trunk/server/meta_worker.rb
r269 r270 168 168 end 169 169 170 # we are overriding the function that checks for timers171 # def check_for_timer_events172 # super173 # return unless @my_schedule174 # if @run_time < Time.now.to_i175 # # self.send(@my_schedule[:worker_method]) if self.respond_to?(@my_schedule[:worker_method])176 # invoke_worker_method177 # @run_time = @trigger.fire_time_after(Time.now).to_i178 # end179 # end170 # we are overriding the function that checks for timers 171 # def check_for_timer_events 172 # super 173 # return unless @my_schedule 174 # if @run_time < Time.now.to_i 175 # # self.send(@my_schedule[:worker_method]) if self.respond_to?(@my_schedule[:worker_method]) 176 # invoke_worker_method 177 # @run_time = @trigger.fire_time_after(Time.now).to_i 178 # end 179 # end 180 180 181 181 def invoke_worker_method trunk/test/backgroundrb_test.rb
r217 r270 1 require 'test/unit' 1 require File.join(File.dirname(__FILE__) + "/bdrb_test_helper") 2 require "backgroundrb" 2 3 3 class BackgroundrbTest < Test::Unit::TestCase 4 # Replace this with your real tests. 5 def test_this_plugin 6 flunk 4 context "Backgroundrb connection in general should" do 5 specify "ask_work should throw exception if connection cant be established" do 6 should.raise(BackgrounDRb::BdrbConnError) do 7 MiddleMan.ask_work(:worker => :hello_worker, :worker_method => :say_hello) 8 end 7 9 end 8 10 end 11 12
