Skip to content

Commit

Permalink
Make find_index public and use it instead of find_node_index in next
Browse files Browse the repository at this point in the history
  • Loading branch information
mika.busch committed Aug 28, 2024
1 parent 48885d4 commit 1e08025
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/oxidized/nodes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def fetch(node_name, group)

# @param node [String] name of the node moved into the head of array
def next(node, opt = {})
return unless waiting.find_node_index(node)
return if running.find_index(node)

with_lock do
n = del node
Expand Down Expand Up @@ -116,6 +116,10 @@ def get_diff(node_name, group, oid1, oid2)
end
end

def find_index(node)
index { |e| [e.name, e.ip].include? node }
end

private

def initialize(opts = {})
Expand All @@ -133,10 +137,6 @@ def with_lock(...)
@mutex.synchronize(...)
end

def find_index(node)
index { |e| [e.name, e.ip].include? node }
end

# @param node node which is removed from nodes list
# @return [Node] deleted node
def del(node)
Expand Down

0 comments on commit 1e08025

Please sign in to comment.