lhotari commented on code in PR #24859:
URL: https://github.com/apache/pulsar/pull/24859#discussion_r2436275046
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/resourcegroup/ResourceGroupService.java:
##########
@@ -540,6 +558,12 @@ protected static Summary.Child.Value
getRgQuotaCalculationTime() {
// Periodically aggregate the usage from all topics known to the
BrokerService.
// Visibility for unit testing.
protected void aggregateResourceGroupLocalUsages() {
+ if (!schedulersRunning.get() || resourceGroupsMap.isEmpty()) {
+ return;
+ }
+ if (tenantToRGsMap.isEmpty() && namespaceToRGsMap.isEmpty()) {
Review Comment:
Would it make sense to have a method `hasActiveResourceGroups()` for
avoiding duplication of the logic?
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/resourcegroup/ResourceGroupService.java:
##########
@@ -690,23 +720,60 @@ protected void calculateQuotaForAllResourceGroups() {
}
}
- private void initialize() {
- ServiceConfiguration config = this.pulsar.getConfiguration();
- long periodInSecs =
config.getResourceUsageTransportPublishIntervalInSecs();
- this.aggregateLocalUsagePeriodInSeconds =
this.resourceUsagePublishPeriodInSeconds = periodInSecs;
- this.aggregateLocalUsagePeriodicTask =
this.pulsar.getExecutor().scheduleAtFixedRate(
+ // True if at least one tenant or namespace is attached to any RG.
+ private boolean hasActiveAttachments() {
Review Comment:
Is "attachment" an existing concept? Just wondering if a resource group
could be considered "active" when it has at least one usage? Therefore the name
could be `hasActiveResourceGroups` etc ?
--
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]