BewareMyPower commented on code in PR #25247:
URL: https://github.com/apache/pulsar/pull/25247#discussion_r2810912691
##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/resourcegroup/ResourceQuotaCalculatorImplTest.java:
##########
@@ -113,6 +113,9 @@ public void testRQCalcGlobUsedZeroTest() throws
PulsarAdminException {
@Test
public void testNeedToReportLocalUsage() {
+ // This field is 0 when the schedulers of `ResourceGroupService` are
not started, then `needToReportLocalUsage`
+ // will always return true. Set it to a non-zero value to test the
percentage change logic.
+ ResourceGroupService.maxIntervalForSuppressingReportsMSecs = 60 *
1000L; // 1 minute
Review Comment:
No need to apply this complicated logic here because only
`needToReportLocalUsage` depends on this config and it's explained in the
comments here.
Actually, we should initialize it when initializing the namespace in
`ResourceGroupNamespaceConfigListener`(`registerNameSpace` ->
`maybeStartSchedulers`). Then it will be set according to the config.
```
maxIntervalForSuppressingReportsMSecs =
TimeUnit.SECONDS.toMillis(this.resourceUsagePublishPeriodInSeconds) *
MaxUsageReportSuppressRounds;
```
But it's out of the scope of this PR. Since it's just a simple unit test, we
can keep it simple as setting this variable manually
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]