Skip to content

Commit

Permalink
fix for finding next available backgroundrb server
Browse files Browse the repository at this point in the history
  • Loading branch information
gnufied committed Jul 3, 2008
1 parent 106f826 commit 3910bc7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 0 additions & 1 deletion lib/backgroundrb/bdrb_connection.rb
Expand Up @@ -86,7 +86,6 @@ def close_connection
end

def ask_work p_data
p p_data
p_data[:type] = :async_invoke
dump_object(p_data)
close_connection
Expand Down
5 changes: 2 additions & 3 deletions lib/backgroundrb/rails_worker_proxy.rb
Expand Up @@ -16,7 +16,6 @@ def method_missing(method_id,*args)
arg,job_key,host_info = arguments && arguments.values_at(:arg,:job_key,:host)

if worker_method =~ /^async_(\w+)/
puts "i am here"
method_name = $1
wokrer_options = compact(:worker => worker_name,:worker_key => worker_key,:worker_method => method_name,:job_key => job_key, :arg => arg)
run_method(host_info,:ask_work,wokrer_options)
Expand Down Expand Up @@ -51,12 +50,12 @@ def run_method host_info,method_name,worker_options = {}
rescue BdrbConnError; end
raise NoServerAvailable.new("No BackgrounDRb server is found running") unless succeeded
else
@tried_connections = connection
@tried_connections = [connection.server_info]
begin
result << invoke_on_connection(connection,method_name,worker_options)
rescue BdrbConnError => e
connection = middle_man.find_next_except_these(@tried_connections)
@tried_connections << connection
@tried_connections << connection.server_info
retry
end
end
Expand Down

0 comments on commit 3910bc7

Please sign in to comment.