Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
olovy committed Apr 19, 2022
1 parent 5040c85 commit a99e13d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rest/src/main/java/whelk/util/RateLimiter.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private void maybeDrainBuckets(long currentTimeMillis) {
long deltaMs = currentTimeMillis - previousUpdate;
long drainAmount = (long) ((deltaMs / 1000.0) * maxRateHz * SCALE_FACTOR);
buckets.forEach((key, bucket) -> {
if (bucket.accumulateAndGet(drainAmount, (current, update) -> Math.max(current - update, 0)) == 0) {
if (0 == bucket.accumulateAndGet(drainAmount, (current, update) -> Math.max(current - update, 0))) {
// we might miss some increments here, that's ok
buckets.remove(key);
}
Expand Down

0 comments on commit a99e13d

Please sign in to comment.