Skip to content

Commit

Permalink
[fix][broker] Consume the ResourceGroup dispatch quota
Browse files Browse the repository at this point in the history
Signed-off-by: Zixuan Liu <[email protected]>
  • Loading branch information
nodece committed Mar 6, 2024
1 parent 46556df commit 1c40913
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ public void readEntriesComplete(List<Entry> entries, Object ctx) {
}

dispatchRateLimiter.ifPresent(rateLimiter -> rateLimiter.tryDispatchPermit(1, entry.getLength()));
resourceGroupDispatchRateLimiter.ifPresent(
rateLimiter -> rateLimiter.consumeDispatchQuota(1, entry.getLength()));

msgOut.recordEvent(headersAndPayload.readableBytes());

Expand Down Expand Up @@ -799,7 +801,8 @@ public void initializeDispatchRateLimiterIfNeeded() {
if (resourceGroupName != null) {
ResourceGroup resourceGroup = resourceGroupService.resourceGroupGet(resourceGroupName);
if (resourceGroup != null) {
resourceGroupDispatchRateLimiter = Optional.of(resourceGroup.getResourceGroupReplicationDispatchLimiter());
resourceGroupDispatchRateLimiter = Optional.of(resourceGroup
.getResourceGroupReplicationDispatchLimiter());
}
} else {
if (resourceGroupDispatchRateLimiter.isPresent()) {
Expand Down

0 comments on commit 1c40913

Please sign in to comment.