-
Notifications
You must be signed in to change notification settings - Fork 2k
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
use both job and type query on scaling policy list endpoint #9312
Conversation
8b84ad8
to
42e5b5b
Compare
42e5b5b
to
ece8cde
Compare
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.
LGTM!
if !ok { | ||
return true | ||
} | ||
return policyType != p.Type |
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 my only comment about this is that it seems like this check could be moved into ScalingPoliciesByJobTxn
, where the new policyType string
would be passed through to it.
Looking at ScalingPoliciesByJobTxn
, it already does the same kind of type assertion we see here, so it happening again (specifically the !ok
part, which I think is inconceivable) makes me want a single filter
.
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.
yeah, maybe 50/50? this short-circuits the filter on the outside of the loop when policyType == ""
, as opposed to doing it on every filter operation. merging them avoids duplicate cast assertion checks.
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
the
/v1/scaling/policies
list endpoint allows filtering by?job
and?type
. unfortunately, the code path forjob
ignored thetype
query. this PR remedies this.unsurprisingly, there weren't any tests protecting this behavior, so those are added as well.
resolves #9227