From b872c47ff9193191c6450f03bbb4e420b6a1219b Mon Sep 17 00:00:00 2001 From: Alessandro Siragusa Date: Mon, 20 Jul 2015 14:44:11 +0000 Subject: [PATCH] Sorting backends --- lib/synapse/haproxy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/synapse/haproxy.rb b/lib/synapse/haproxy.rb index 2093bb99..ae37e529 100644 --- a/lib/synapse/haproxy.rb +++ b/lib/synapse/haproxy.rb @@ -662,7 +662,7 @@ def generate_backend_stanza(watcher, config) stanza = [ "\nbackend #{watcher.name}", config.map {|c| "\t#{c}"}, - watcher.backends.shuffle.map {|backend| + watcher.backends.sort_by { |backend| backend['host'] + backend['port'].to_s }.map {|backend| backend_name = construct_name(backend) b = "\tserver #{backend_name} #{backend['host']}:#{backend['port']}" b = "#{b} cookie #{backend_name}" unless config.include?('mode tcp')