Permalink
Browse files

more consistent naming

  • Loading branch information...
1 parent 28a5df4 commit c5e3f53f69c6c26c24f0ac8f4efedbd46b319006 @skaes skaes committed Jul 12, 2010
Showing with 5 additions and 5 deletions.
  1. +2 −2 lib/beetle/redis_configuration_server.rb
  2. +3 −3 test/beetle/redis_configuration_server_test.rb
@@ -158,7 +158,7 @@ def determine_initial_master
current_master or raise NoRedisMaster.new("failed to determine initial redis master")
end
- def detect_new_master
+ def determine_new_master
redis.unknowns.include?(current_master) ? redis.slaves_of(current_master).first : current_master
end
@@ -210,7 +210,7 @@ def all_client_invalidated_ids_received?
end
def switch_master
- if new_master = detect_new_master
+ if new_master = determine_new_master
msg = "Setting redis master to '#{new_master.server}' (was '#{current_master.server}')"
logger.warn(msg)
beetle.publish(:system_notification, {"message" => msg}.to_json)
@@ -120,15 +120,15 @@ def setup
test "switching the master should turn the new master candidate into a master" do
new_master = stub(:master! => nil, :server => "jo:6379")
@server.beetle.expects(:publish).with(:system_notification, anything)
- @server.expects(:detect_new_master).returns(new_master)
+ @server.expects(:determine_new_master).returns(new_master)
@server.send :switch_master
assert_equal new_master, @server.current_master
end
test "switching the master should resort to the old master if no candidate can be found" do
old_master = @server.current_master
@server.beetle.expects(:publish).with(:system_notification, anything)
- @server.expects(:detect_new_master).returns(nil)
+ @server.expects(:determine_new_master).returns(nil)
@server.send :switch_master
assert_equal old_master, @server.current_master
end
@@ -251,7 +251,7 @@ def setup
@redis_slave.expects(:slave_of?).returns(true)
@server.instance_variable_set(:@current_master, not_available_redis_master)
@server.instance_variable_set(:@redis, build_redis_server_info(@redis_slave, not_available_redis_master))
- assert_equal @redis_slave, @server.send(:detect_new_master)
+ assert_equal @redis_slave, @server.send(:determine_new_master)
end
private

0 comments on commit c5e3f53

Please sign in to comment.