Skip to content

Commit fc9294c

Browse files
committed
fix the untagged server selection
1 parent 664fbe2 commit fc9294c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

app/models/server.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,13 @@ def self.find_available(tags_arg = nil)
308308
ids_loads_tagged.concat ids_loads.select { |myid, _| redis.hget(key(myid), 'tag') == tag }
309309
end
310310
ids_loads_tagged.sort_by { |id_load| id_load[1] }
311-
if ids_loads_tagged.blank?
312-
raise BBBErrors::ServerTagUnavailableError, tags_arg if tags_required
313-
tags = nil # fall back to servers without tag
314-
ids_loads_tagged = ids_loads.select { |myid, _| redis.hget(key(myid), 'tag').nil? }
315-
end
316-
ids_loads = ids_loads_tagged
317311
end
312+
if ids_loads_tagged.blank?
313+
raise BBBErrors::ServerTagUnavailableError, tags_arg if tags_required
314+
tags = nil # fall back to servers without tag
315+
ids_loads_tagged = ids_loads.select { |myid, _| redis.hget(key(myid), 'tag').nil? }
316+
end
317+
ids_loads = ids_loads_tagged
318318

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

0 commit comments

Comments
 (0)