-
Notifications
You must be signed in to change notification settings - Fork 898
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
Only reload settings for servers in current region #17992
Only reload settings for servers in current region #17992
Conversation
app/models/miq_region.rb
Outdated
@@ -62,7 +62,7 @@ def miq_servers | |||
end | |||
|
|||
def servers_for_settings_reload | |||
miq_servers.where(:status => "started") | |||
MiqServer.in_my_region.where(:status => "started") |
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.
That's not accurate either.
For example, if we have current region 1 has server 1, and region 2 has server 2, and if someone makes a change to the settings for region 2, then this method will return server 1, which is wrong. It should instead return []
. I think you can do miq_servers.in_my_region
, which, while a strange mix, is accurate (probably would warrant a code comment). While it might be better to be explicit, and return a literal []
, I'd prefer to keep the method chainable.
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.
miq_servers.in_my_region
Hm this is what I had first but thought it was weird to be chaining .in_region(region_number).in_my_region
but yeah that is wrong
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.
👍 done
app/models/miq_region.rb
Outdated
@@ -62,7 +62,7 @@ def miq_servers | |||
end | |||
|
|||
def servers_for_settings_reload | |||
miq_servers.where(:status => "started") | |||
MiqServer.in_my_region.where(:status => "started") |
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.
Won't this unnecessarily queue a settings reload for the servers in_my_region
if some other region is updated?
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.
@bdunne already fixed per @Fryguy's comment #17992 (comment)
When changing settings for a different region, only queue a settings reload for servers in the current region. Fixes test failures e.g https://travis-ci.org/ManageIQ/manageiq-api/jobs/430035513#L2033-L2045
7f81d66
to
3d43d72
Compare
Checked commit agrare@3d43d72 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
When changing settings for a different region, only queue a settings
reload for servers in the current region.
Fixes test failures e.g https://travis-ci.org/ManageIQ/manageiq-api/jobs/430035513#L2033-L2045