Skip to content

Commit

Permalink
Migrate deprecated Bucket4J class usage to Bucket class to unblock up…
Browse files Browse the repository at this point in the history
…grades
  • Loading branch information
danielburrell committed Jul 29, 2024
1 parent 6a9a69b commit 13a0e01
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import io.github.bucket4j.Bandwidth;
import io.github.bucket4j.Bucket4j;
import io.github.bucket4j.Bucket;
import io.github.bucket4j.Refill;
import io.github.bucket4j.local.LocalBucket;
import io.github.bucket4j.local.SynchronizationStrategy;
Expand Down Expand Up @@ -65,7 +65,7 @@ public boolean filter(CoreV1Event event) {

private class SpamRecord {
private LocalBucket tokenBucket =
Bucket4j.builder()
Bucket.builder()
.addLimit(
Bandwidth.classic(
capacity, Refill.greedy(refillingTokensPerPeriod, refillingPeriod)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import io.github.bucket4j.Bandwidth;
import io.github.bucket4j.Bucket;
import io.github.bucket4j.Bucket4j;
import io.github.bucket4j.Refill;
import io.github.bucket4j.local.SynchronizationStrategy;
import java.time.Duration;
Expand All @@ -32,7 +31,7 @@ public BucketRateLimiter(long capacity, long tokensGeneratedInPeriod, Duration p
Bandwidth bandwidth =
Bandwidth.classic(capacity, Refill.greedy(tokensGeneratedInPeriod, period));
this.bucket =
Bucket4j.builder()
Bucket.builder()
.addLimit(bandwidth)
.withSynchronizationStrategy(SynchronizationStrategy.SYNCHRONIZED)
.build();
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<caffeine.version>2.9.3</caffeine.version>
<protobuf.version>4.27.1</protobuf.version>
<junit-jupiter.version>5.10.2</junit-jupiter.version>
<bucket4j.version>8.0.1</bucket4j.version>
<bucket4j.version>8.10.1</bucket4j.version>
<bouncycastle.version>1.78.1</bouncycastle.version>
<gson.version>2.11.0</gson.version>
<jackson.version>2.17.1</jackson.version>
Expand Down

0 comments on commit 13a0e01

Please sign in to comment.