Permalink
Browse files

add check for invalid role check

  • Loading branch information...
1 parent 1460bef commit 6937a1906c7d8e667dc135c07acc8dcbec8d3037 @ryanlecompte committed Nov 13, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/redis_failover/node_manager.rb
View
9 lib/redis_failover/node_manager.rb
@@ -259,9 +259,14 @@ def find_existing_master
# Check for case where a node previously thought to be the master was
# somehow manually reconfigured to be a slave outside of the node manager's
# control.
- if master && master.slave?
- raise InvalidNodeRoleError.new(master, :master, :slave)
+ begin
+ if master && master.slave?
+ raise InvalidNodeRoleError.new(master, :master, :slave)
+ end
+ rescue => RedisFailover::NodeUnavailableError => ex
+ logger.warn("Failed to check whether existing master has invalid role", ex)
end
+
master
end
rescue ZK::Exceptions::NoNode

0 comments on commit 6937a19

Please sign in to comment.