Skip to content
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(kube-runtime): setup backoff with builder pattern #1603

Merged
merged 4 commits into from
Oct 14, 2024

Conversation

tiagolobocastro
Copy link
Contributor

Filling the fields manually and leaving the current_interval out meant that the current_interval is set to its default rather than track the initial_interval
The builder addresses this for us by setting it on the build method.

Motivation

Noticed that the current_interval of the watcher backoff is left empty, which may lead to unintended behaviour.
Granted the difference is currently minimal (800ms to 500ms)

Solution

Using the builder pattern method from the backoff crate can be used to set the fields appropriately rather than simply the default value.

Filling the fields manually and leaving the current_interval out
meant that the current_interval is set to its default rather than
track the initial_interval
The builder addresses this for us by setting it on the build method.

Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
Copy link

codecov bot commented Oct 14, 2024

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 75.2%. Comparing base (a6060c4) to head (a181dec).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
kube-runtime/src/watcher.rs 0.0% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1603     +/-   ##
=======================================
+ Coverage   75.2%   75.2%   +0.1%     
=======================================
  Files         82      82             
  Lines       7336    7335      -1     
=======================================
  Hits        5514    5514             
+ Misses      1822    1821      -1     
Files with missing lines Coverage Δ
kube-runtime/src/watcher.rs 44.4% <0.0%> (+0.2%) ⬆️

@clux clux added the changelog-fix changelog fix category for prs label Oct 14, 2024
@clux clux added this to the 0.97.0 milestone Oct 14, 2024
Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

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

Thank you!

Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
@tiagolobocastro
Copy link
Contributor Author

Thanks @clux, I've fixed the fmt and also added a test, so hopefully code cov is also ok now.

kube-runtime/src/watcher.rs Outdated Show resolved Hide resolved
This reverts commit fd3d1c2.

Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
@clux clux merged commit 95cf702 into kube-rs:main Oct 14, 2024
17 checks passed
@tiagolobocastro tiagolobocastro deleted the backoff-current branch October 14, 2024 21:41
@clux clux mentioned this pull request Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-fix changelog fix category for prs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants