Skip to content

Commit

Permalink
Address feedback from igor and schleyfox
Browse files Browse the repository at this point in the history
Adds a comment about when we write out the file output and restored
random backend ordering.
  • Loading branch information
Joseph Lynch committed Jul 23, 2015
1 parent b3c0fb7 commit cd2ea63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/synapse/file_output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ def write_backends_to_file(service_name, new_backends)
end

if old_backends == new_backends
# Prevent modifying the file unless something has actually changed
# This way clients can set watches on this file and update their
# internal state only when the smartstack state has actually changed
return false
else
# Atomically write new sevice configuration file
Expand Down
3 changes: 2 additions & 1 deletion lib/synapse/haproxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,8 @@ def generate_backend_stanza(watcher, config)
stanza = [
"\nbackend #{watcher.name}",
config.map {|c| "\t#{c}"},
backends.map {|backend_name, backend|
backends.keys.shuffle.map {|backend_name|
backend = backends[backend_name]
b = "\tserver #{backend_name} #{backend['host']}:#{backend['port']}"
b = "#{b} cookie #{backend_name}" unless config.include?('mode tcp')
b = "#{b} #{watcher.haproxy['server_options']}"
Expand Down

0 comments on commit cd2ea63

Please sign in to comment.