Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cleanup

  • Loading branch information...
commit 6f4ab20a7d17f9c3573bdbd551c9175786f99b6a 1 parent cab8c46
@ryanlecompte authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/redis_failover/node_manager.rb
View
10 lib/redis_failover/node_manager.rb
@@ -438,6 +438,12 @@ def write_current_redis_nodes
write_state(redis_nodes_path, encode(current_nodes))
end
+ # Writes the current monitored list of redis nodes. This method is always
+ # invoked by all running node managers.
+ def write_current_monitored_state
+ write_state(current_state_path, encode(node_availability_state), :ephemeral => true)
+ end
+
# @return [String] root path for current node manager state
def current_state_root
"#{@root_znode}/manager_node_state"
@@ -506,14 +512,14 @@ def update_current_state(node, state, latency = nil)
unless @monitored_unavailable.include?(node)
@monitored_unavailable << node
@monitored_available.delete(node)
- write_state(current_state_path, encode(node_availability_state), :ephemeral => true)
+ write_current_monitored_state
end
when :available
last_latency = @monitored_available[node]
if last_latency.nil? || (latency - last_latency) > LATENCY_THRESHOLD
@monitored_available[node] = latency
@monitored_unavailable.delete(node)
- write_state(current_state_path, encode(node_availability_state), :ephemeral => true)
+ write_current_monitored_state
end
else
raise InvalidNodeStateError.new(node, state)
Please sign in to comment.
Something went wrong with that request. Please try again.