Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
brycezhongqing committed Jan 3, 2024
1 parent a909b0b commit 1bde9b1
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,14 @@ public void checkAndSwitchMode(String d2ServiceName)
LOG.info("Dual read mode executor is shut down already. Skipping getting the latest dual read mode.");
return;
}

if (d2ServiceName == null)
{
return;
}
_executorService.execute(() ->
{
if(d2ServiceName == null){
return;
}
RateLimiter serviceRateLimiter = _serviceToRateLimiterMap.computeIfAbsent(
d2ServiceName,
key -> RateLimiter.create((double) 1 / DUAL_READ_MODE_SWITCH_MIN_INTERVAL)
);
RateLimiter serviceRateLimiter = _serviceToRateLimiterMap.computeIfAbsent(d2ServiceName,
key -> RateLimiter.create((double) 1 / DUAL_READ_MODE_SWITCH_MIN_INTERVAL));
boolean shouldCheck = serviceRateLimiter.tryAcquire();
if (shouldCheck)
{
Expand Down

0 comments on commit 1bde9b1

Please sign in to comment.