resource_group client: prevent NaN in zero-duration calcAvg (#11023)#11029
resource_group client: prevent NaN in zero-duration calcAvg (#11023)#11029JmPotato wants to merge 1 commit into
Conversation
…s zero A freshly created groupCostController can be published between the updateRunState and updateAvgRequestResourcePerSec passes of the same tick, in which case gc.run.now still equals the avgLastTime set by initRunState and calcAvg computes (0-0)/0 = NaN, permanently poisoning avgRUPerSec and making every subsequent token-bucket request carry required-token=NaN until the idle cleanup deletes the controller. Skip the sample when the elapsed duration is non-positive, and update the burstable flag before sampling so a skipped sample does not delay it. Add a regression test covering the exact scenario. Signed-off-by: JmPotato <github@ipotato.me> (cherry picked from commit f2bcfc2) Signed-off-by: JmPotato <github@ipotato.me>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-nextgen-202603 #11029 +/- ##
==========================================================
- Coverage 79.19% 79.14% -0.05%
==========================================================
Files 532 532
Lines 72818 72818
==========================================================
- Hits 57665 57632 -33
- Misses 11118 11140 +22
- Partials 4035 4046 +11
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
[LGTM Timeline notifier]Timeline:
|
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lhy1024 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This is a cherry-pick of #11023 to
release-nextgen-202603.What problem does this PR solve?
Issue Number: ref #11022, ref #9455
What is changed and how does it work?
The target branch already contains the non-positive duration guard from #10866.
This cherry-pick preserves that shared implementation and applies the remaining
source behavior plus regression coverage.
Check List
Tests
Release note