Skip to content

validate duration settings#3558

Merged
RTann merged 6 commits intomasterfrom
ross/duration-setting-panic
Oct 27, 2022
Merged

validate duration settings#3558
RTann merged 6 commits intomasterfrom
ross/duration-setting-panic

Conversation

@RTann
Copy link
Contributor

@RTann RTann commented Oct 25, 2022

Description

  • Panic upon registering duration setting with invalid default value.
  • Only allow for users to set durations > 0. Otherwise, they do not make much sense.

Checklist

  • Investigated and inspected CI test results
  • [ ] Unit test and regression tests added
  • [ ] Evaluated and added CHANGELOG entry if required
  • [ ] Determined and documented upgrade steps
  • [ ] Documented user facing changes (create PR based on openshift/openshift-docs and merge into rhacs-docs)

Testing Performed

CI

@RTann RTann changed the title ensure duration environment variable default values are valid validate duration settings Oct 25, 2022
Copy link
Contributor

@misberner misberner left a comment

Choose a reason for hiding this comment

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

Don't we ever use 0 to indicate "never"? I think I found this at least for the notification debounce setting, possibly others as well.

Copy link
Contributor

@misberner misberner left a comment

Choose a reason for hiding this comment

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

See other PR, we use a default of 0 for the alert notification debounce setting to indicate no debounce

@RTann
Copy link
Contributor Author

RTann commented Oct 25, 2022

See other PR, we use a default of 0 for the alert notification debounce setting to indicate no debounce

@misberner which other PR?

@RTann
Copy link
Contributor Author

RTann commented Oct 25, 2022

See other PR, we use a default of 0 for the alert notification debounce setting to indicate no debounce

I do see we use 0 for ROX_ALERT_RENOTIF_DEBOUNCE_DURATION and ROX_RECORDER_DURATION (which I don't think is used anymore?). That being said, allowing 0 makes sense, but I do feel there are times where 0 should not be allowed. I wonder if I should add an option to allow/disallow 0. What do you think?

@RTann
Copy link
Contributor Author

RTann commented Oct 25, 2022

PR to remove ROX_RECORDER_DURATION #3559

@RTann RTann requested a review from misberner October 26, 2022 21:14
@ghost
Copy link

ghost commented Oct 26, 2022

Images are ready for the commit at b1a99f1.

To use with deploy scripts, first export MAIN_IMAGE_TAG=3.72.x-423-gb1a99f16a0.

@misberner
Copy link
Contributor

@misberner which other PR?

I got two separate email threads because you renamed the PR, so I just assumed it was a different PR :) was on my phone

@misberner
Copy link
Contributor

I wonder if I should add an option to allow/disallow 0. What do you think?

Hmm, personally I would think that disallowing 0 durations should happen at the level of the logic that consumes the duration setting. But I guess you could make the case that a 0 duration that is not intercepted can be very dangerous when it leads to code running in a loop with no delay when there should be a delay between iterations, and thus consuming insane amounts of CPU. Therefore, yeah, I think it makes sense to prescribe that a 0 duration has to be allowed explicitly.

@RTann RTann merged commit dc04d15 into master Oct 27, 2022
@RTann RTann deleted the ross/duration-setting-panic branch October 27, 2022 18:08
ivan-degtiarenko pushed a commit that referenced this pull request Nov 5, 2022
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.

2 participants