Skip to content

BZ 1388319 handle -1 in maxScheduledImageImportsPerMinute #13315

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

Merged
merged 1 commit into from
Mar 16, 2017

Conversation

pweil-
Copy link

@pweil- pweil- commented Mar 8, 2017

master panics when setting -1 in maxScheduledImageImportsPerMinute though it should be handled. It is specific, validated value and was documented as unlimited.

This checks for -1 and sets the limiter to the NewFakeAlwaysRateLimiter. This name is confusing but it looks like it is the one that won't block on accept and is used in tests to turn off limiting

@mfojtik @smarterclayton WDYT? The other option, I suppose, is to remove the validation and just have users set this to a very high value themselves.


var limiter flowcontrol.RateLimiter = nil
if c.Options.ImagePolicyConfig.MaxScheduledImageImportsPerMinute == -1 {
limiter = flowcontrol.NewTokenBucketRateLimiter(math.MaxFloat32, math.MaxInt32)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THere's an unlimited rate limiter (which is a hardcoded no-op to succeed). Use that instead. Also, you should have <=0, because someone could call this code with 0.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking for something like that and didn't see it. I'll look again.

Any negative number greater that -1 is rejected in ValidateImagePolicyConfig but I'll change this anyway

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NewFakeNeverRateLimiter

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh, I was going to use it but I ignored it because of the "fake" in the name and only saw it being used in tests so I didn't want to shoot myself in the foot. Thanks.

@pweil- pweil- force-pushed the image-import-rate branch from b437825 to 4992e26 Compare March 15, 2017 12:46
@pweil-
Copy link
Author

pweil- commented Mar 15, 2017

[test]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 4992e26

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/230/) (Base Commit: 0009bfa)

@smarterclayton
Copy link
Contributor

LGTM [merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 4992e26

@openshift-bot
Copy link
Contributor

openshift-bot commented Mar 16, 2017

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/104/) (Base Commit: 906adf9) (Image: devenv-rhel7_6072)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants