Skip to content

Commit

Permalink
fix(ratelimits): fixed buckets breaking after a set amount of time
Browse files Browse the repository at this point in the history
  • Loading branch information
seailz committed Nov 10, 2024
1 parent fcdaa86 commit 800bf95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/com/seailz/discordjar/DiscordJar.java
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,9 @@ public void removeBucket(Bucket bucket) {
public Bucket getBucketForUrl(String url) {
final List<Bucket> buckets = new ArrayList<>(this.buckets);
for (Bucket bucket : buckets) {
if (bucket.getAffectedRoutes().contains(url)) return bucket;
List<String> affectedRoutes = bucket.getAffectedRoutes();
if (affectedRoutes == null) continue;
if (affectedRoutes.contains(url)) return bucket;
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public Bucket addAffectedRoute(String route) {
}

public List<String> getAffectedRoutes() {
if (affectedRoutes == null) return new ArrayList<>();

Check warning on line 84 in src/main/java/com/seailz/discordjar/utils/rest/ratelimit/Bucket.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Constant values

Condition `affectedRoutes == null` is always `false`
return affectedRoutes;
}

Expand Down

0 comments on commit 800bf95

Please sign in to comment.