-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create an option to stop ignoring weights. By default weights will still be ignored. #174
base: master
Are you sure you want to change the base?
Changes from all commits
06c8433
d5ea7b0
c3bcd29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -742,6 +742,14 @@ def generate_backend_stanza(watcher, config) | |
b = "\tserver #{backend_name} #{backend['host']}:#{backend['port']}" | ||
b = "#{b} cookie #{backend_name}" unless config.include?('mode tcp') | ||
b = "#{b} #{watcher.haproxy['server_options']}" if watcher.haproxy['server_options'] | ||
if backend.has_key?('weight') | ||
# Check if server_options already contains weight, is so log a warning | ||
if watcher.haproxy['server_options'].include? 'weight' | ||
log.warn "synapse: weight is defined by server_options and by nerve" | ||
end | ||
weight = backend['weight'].to_i | ||
b = "#{b} weight #{weight}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I believe that HAProxy will use the last weight provided. If that's true I think this should probably slot this in between the HAProxy backend There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or maybe we should bail of server options also contains weight? i don't have a strong feeling as to what the precedence order should be... at least printing a warning to logs when there are contradictory options seems like a good idea. this is probably indicating that it's time to refactor this function, it's getting pretty big. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea, I noted a similar concern about complexity in #171. I'm not sure if these PRs are the right place for that though or if we should refactor it once they're merged. I agree printing a warning is useful, but I don't think we should bail out as I can understand use cases where someone might want to set some combination as a fallback scheme. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
end | ||
b = "#{b} #{backend['haproxy_server_options']}" if backend['haproxy_server_options'] | ||
b = "#{b} disabled" unless backend['enabled'] | ||
b } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the backend (server) provided
haproxy_server_options
data is a more concerning conflict thanserver_options
(a weight in theserver_options
would be like a default for servers or something).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jolynch, that's a good point. To reduce the number of iteration for this PR, could you suggest what message you'd like to see when haproxy_server_options also includes weight?