Skip to content

Commit

Permalink
fix the untagged server selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Ithanil committed Dec 3, 2024
1 parent 664fbe2 commit fc9294c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app/models/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,13 @@ def self.find_available(tags_arg = nil)
ids_loads_tagged.concat ids_loads.select { |myid, _| redis.hget(key(myid), 'tag') == tag }
end
ids_loads_tagged.sort_by { |id_load| id_load[1] }
if ids_loads_tagged.blank?
raise BBBErrors::ServerTagUnavailableError, tags_arg if tags_required
tags = nil # fall back to servers without tag
ids_loads_tagged = ids_loads.select { |myid, _| redis.hget(key(myid), 'tag').nil? }
end
ids_loads = ids_loads_tagged
end
if ids_loads_tagged.blank?
raise BBBErrors::ServerTagUnavailableError, tags_arg if tags_required
tags = nil # fall back to servers without tag
ids_loads_tagged = ids_loads.select { |myid, _| redis.hget(key(myid), 'tag').nil? }
end
ids_loads = ids_loads_tagged

# try to select the server with lowest load
id, load, hash = ids_loads.each do |id, load|
Expand Down

0 comments on commit fc9294c

Please sign in to comment.