Skip to content

Commit

Permalink
[Issue 11581][broker] feat:pass the executor to RateLimiter in Resour…
Browse files Browse the repository at this point in the history
…ceGroupPublishLimiter (#11582)

### background

Fixes #11581 

### Motivation

we need to pass the executor to RateLimiter in ResourceGroupPublishLimiter

### Modifications

 pass the executor to RateLimiter in ResourceGroupPublishLimiter
  • Loading branch information
leizhiyuan committed Aug 21, 2021
1 parent d10100f commit f7957a5
Showing 1 changed file with 8 additions and 8 deletions.
Expand Up @@ -95,23 +95,23 @@ public void update(ResourceGroup resourceGroup) {
this.publishMaxMessageRate = Math.max(resourceGroup.getPublishRateInMsgs(), 0);
this.publishMaxByteRate = Math.max(resourceGroup.getPublishRateInBytes(), 0);
if (this.publishMaxMessageRate > 0) {
// TODO: pass the executor
publishRateLimiterOnMessage = RateLimiter.builder()
.scheduledExecutorService(scheduledExecutorService)
.permits(publishMaxMessageRate)
.rateTime(1L)
.timeUnit(TimeUnit.SECONDS)
.rateLimitFunction(this::apply)
.build();
}
if (this.publishMaxByteRate > 0) {
// TODO: pass the executor
publishRateLimiterOnByte =
RateLimiter.builder()
.permits(publishMaxByteRate)
.rateTime(1L)
.timeUnit(TimeUnit.SECONDS)
.rateLimitFunction(this::apply)
.build();
RateLimiter.builder()
.scheduledExecutorService(scheduledExecutorService)
.permits(publishMaxByteRate)
.rateTime(1L)
.timeUnit(TimeUnit.SECONDS)
.rateLimitFunction(this::apply)
.build();
}
} else {
this.publishMaxMessageRate = 0;
Expand Down

0 comments on commit f7957a5

Please sign in to comment.