-
Notifications
You must be signed in to change notification settings - Fork 15
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
fix: optimize profile_by_app_group_name to query only active AppGroups #308
base: master
Are you sure you want to change the base?
Conversation
) | ||
|
||
if @app_group.blank? || !@app_group.ACTIVE? | ||
if @app_group.blank? || @app_group.status != "ACTIVE" |
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.
we don't need the @app_group.status != "ACTIVE"
since it already filter on find_by process.
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.
ack,
@@ -163,6 +164,14 @@ def profile_by_app_group_name | |||
@helm_infrastructure = @app_group.helm_infrastructure_in_default_location | |||
@helm_infrastructure = @app_group.helm_infrastructures.active.first unless @helm_infrastructure.present? | |||
|
|||
if @helm_infrastructure.blank? |
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.
do we need this check inside the present? since it will never be called.
) | ||
|
||
if @app_group.blank? || !@app_group.ACTIVE? | ||
if @app_group.blank? || @app_group.status != "ACTIVE" |
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.
similar from above related to status != "ACTIVE"
render(json: { | ||
success: false, | ||
errors: ['App Group not found'], | ||
code: 404, | ||
}, status: :not_found) && return | ||
end | ||
|
||
if @helm_infrastructure.blank? |
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 don't think we need this right? where @helm_infrastructure defined?
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.
in my case when testing in local, its happen if there are appgroups that have provisioning status PENDING
and status INACTIVE
, . if i remove this, it will throw a random html response if i hit the appgroup that have condition like that.
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.
what's this random html? is it 404 or 500? if it is 404, I guess it is expected because it is still not active, wdyt @fadlinurhasan
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.
its 404, make sense, will update it
No description provided.