Skip to content

Commit

Permalink
couple websocket and ratelimit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
seailz committed Nov 13, 2024
1 parent 1382866 commit bee9ae9
Show file tree
Hide file tree
Showing 2 changed files with 5 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 @@ -399,7 +399,9 @@ public Bucket getBucket(String id) {
}

public void updateBucket(String id, Bucket bucket) {
if (bucket == null) return;
for (int i = 0; i < buckets.size(); i++) {
if (buckets.get(i) == null) continue;
if (buckets.get(i).id().equals(id)) {
buckets.remove(i);
return;
Expand All @@ -415,9 +417,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 == null) continue;
List<String> affectedRoutes = bucket.getAffectedRoutes();
if (affectedRoutes == null) continue;
if (bucket == null) continue;
if (affectedRoutes.contains(url)) return bucket;
}
return null;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/seailz/discordjar/ws/WebSocket.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ public void onFailure(@NotNull okhttp3.WebSocket webSocket, @NotNull Throwable t
e.printStackTrace();
}
}

webSocket.close(1006, t.getMessage());
}

/**
Expand Down

0 comments on commit bee9ae9

Please sign in to comment.