Permalink
Browse files

remove commented code from cluster connection

  • Loading branch information...
1 parent 5be5547 commit cbb2c36cddb910496cd0149557f3bc75e940c216 @gnufied committed Jun 24, 2008
Showing with 3 additions and 56 deletions.
  1. +0 −51 lib/backgroundrb/bdrb_cluster_connection.rb
  2. +0 −2 server/lib/meta_worker.rb
  3. +3 −3 test_points.org
@@ -7,8 +7,6 @@ class ClusterConnection
def initialize
@bdrb_servers = []
-# @backend_connections = Packet::DoubleKeyedHash.new
-# @disconnected_connections = Packet::DoubleKeyedHash.new
@backend_connections = []
@disconnected_connections = {}
@@ -47,8 +45,6 @@ def establish_connections
@bdrb_servers << OpenStruct.new(:ip => BDRB_CONFIG[:backgroundrb][:ip],:port => BDRB_CONFIG[:backgroundrb][:port].to_i)
end
@bdrb_servers.each_with_index do |connection_info,index|
- #t_connection = Connection.new(connection_info.ip,connection_info.port,self)
- # @backend_connections[t_connection.server_info,index] = t_connection
@backend_connections << Connection.new(connection_info.ip,connection_info.port,self)
end
end # end of method establish_connections
@@ -79,12 +75,6 @@ def find_next_except_these connections
end
def worker(worker_name,worker_key = nil)
-# if worker_key
-# return find_among_cluster worker_name,worker_key
-# else
-# chosen = choose_server
-# chosen.worker(worker_name,worker_key)
-# end
update_stats
RailsWorkerProxy.new(worker_name,worker_key,self)
end
@@ -103,34 +93,6 @@ def time_to_discover?
end
end
- def find_among_cluster worker_name,worker_key
- t_key = gen_worker_key(worker_name,worker_key)
- if chosen_worker = delegate_to_new_worker(t_key)
- return chosen_worker
- else
- refresh_new_worker_cache
- return delegate_to_new_worker(t_key)
- end
- end
-
- def delegate_to_new_worker key
- t_connections = @cached_new_workers[t_key]
- return nil if t_connections.blank?
- first_connection = @backend_connections[t_connections[0]]
- first_connection.worker(worker_name,worker_key)
- end
-
- def refresh_new_worker_cache
- info_data = all_worker_info
- info_data.each do |key,value|
- value.each do |worker_status|
- next if worker_status[:worker_key].nil? or worker_status[:worker_key].empty?
- @cached_new_workers[worker_status[:worker_key]] ||= []
- @cached_new_workers[worker_status[:worker_key]] << key
- end
- end
- end
-
def all_worker_info
update_stats
info_data = {}
@@ -143,19 +105,6 @@ def all_worker_info
# one of the backend connections are chosen and worker is started on it
def new_worker options = {}
update_stats
- #chosen = choose_server
- # t_key = gen_worker_key(options[:worker],options[:worker_key])
- # @cached_new_workers[t_key] ||= []
- # @cached_new_workers[t_key] << chosen.server_info
- # tried_connections = [chosen]
- # begin
- # chosen.new_worker(options)
- # rescue BdrbConnError => e
- # chosen = find_next_except_these(tried_connections)
- # tried_connections << chosen
- # retry
- # end
- # Should succeed on at least one
succeeded = false
@backend_connections.each do |connection|
begin
@@ -169,7 +169,6 @@ def return_result_object p_data
def process_request(p_data)
user_input = p_data[:data]
if (user_input[:worker_method]).nil? or !respond_to?(user_input[:worker_method])
- p user_input[:worker_method]
result = nil
send_response(p_data,result)
return
@@ -264,7 +263,6 @@ def check_for_enqueued_tasks
def check_for_timer_events
super
- #check_for_enqueued_tasks
return if @worker_method_triggers.nil? or @worker_method_triggers.empty?
@worker_method_triggers.delete_if { |key,value| value[:trigger].respond_to?(:end_time) && value[:trigger].end_time <= Time.now }
View
@@ -3,10 +3,10 @@
** Scheduling via unix scheduler is working
** creating a worker using job_key is working
** Creating a worker and its scheduling is working
-** ask_work is working
-** send_request is working
+** ask_work is working => check
+** send_request is working => check
** all_worker_info is workign
-** status retrieval is working
+** status retrieval is working => check
** sending of large objects around is working
** sending of rails AR objects is working
** sending of rails AR objects with plugin is working

0 comments on commit cbb2c36

Please sign in to comment.