Improve and fix the discord rate limit warnings #37

Merged
YoyoNow merged 5 commits from VelocityCore/ImproveDiscordChannel into main 2025-04-16 20:16:52 +02:00
Owner
No description provided.
YoyoNow added the
System
VelocityCore
label 2025-04-08 20:53:23 +02:00
YoyoNow added 1 commit 2025-04-08 20:53:24 +02:00
Improve and fix the discord rate limit warnings
Some checks failed
SteamWarCI Build failed
4c6ab2c1a0
YoyoNow requested review from Lixfel 2025-04-08 20:53:24 +02:00
Lixfel requested changes 2025-04-08 21:36:17 +02:00
Dismissed
Lixfel left a comment
Owner

A: Es baut nicht.
B: Die ganze Komplexität und knappe Berechnung gefällt mir überhaupt nicht. Revert zu vor dem Webhookgedöns?

A: Es baut nicht. B: Die ganze Komplexität und knappe Berechnung gefällt mir überhaupt nicht. Revert zu vor dem Webhookgedöns?
YoyoNow added 1 commit 2025-04-09 09:03:10 +02:00
Make it buildable and reduce complexity
All checks were successful
SteamWarCI Build successful
038f54c3b3
Author
Owner

Was ist das Problem an der knappen Berechnung? Bzw wo siehst du eine knappe Berechnung?

Was ist das Problem an der knappen Berechnung? Bzw wo siehst du eine knappe Berechnung?
YoyoNow added 1 commit 2025-04-09 09:10:34 +02:00
Update the message limits
All checks were successful
SteamWarCI Build successful
4a816696ec
Lixfel requested changes 2025-04-12 14:52:10 +02:00
Dismissed
@ -47,2 +51,4 @@
}
private final Queue<Webhook> webhooks = new ArrayDeque<>();
private final int maxNumberOfWebhooks;
Owner

Bitte umsortieren, sodass das Argument im AllArgsConstructor wie auch den anderen Konstruktoren hinten dran ist.

Bitte umsortieren, sodass das Argument im AllArgsConstructor wie auch den anderen Konstruktoren hinten dran ist.
YoyoNow marked this conversation as resolved
@ -64,3 +82,3 @@
}
public void send(String message) {
public synchronized void send(String message) {
Owner

Die ganze Funktion (die durchaus länger blockieren kann) als synchronized ist ungeil.

Die ganze Funktion (die durchaus länger blockieren kann) als synchronized ist ungeil.
YoyoNow marked this conversation as resolved
@ -111,0 +114,4 @@
webhooks.add(webhook);
// This works as per this documentation: https://discord.com/developers/docs/resources/webhook#execute-webhook
IncomingWebhookClientImpl webhookClient = (IncomingWebhookClientImpl) WebhookClient.createClient(DiscordBot.getInstance().getJda(), webhook.getUrl());
Owner

Hast du überprüft, ob es andere IP-basierte Webhook-restriktionen gibt? Wenn wir da plötzlich mit einer Menge Webhooks ankommen...

Hast du überprüft, ob es andere IP-basierte Webhook-restriktionen gibt? Wenn wir da plötzlich mit einer Menge Webhooks ankommen...
Author
Owner

So, es gibt ein Cloudflare rate limit von 50 requests pro IP pro Sekunde über alle requests. Außerdem wird hier von einem limit pro ip und path gesprochen jedoch nicht gesagt wie hoch dieser ist: https://stackoverflow.com/questions/59117210/discord-webhook-rate-limits . Außerdem findest du über dieses limit nach meiner Recherche nichts auf der discord developer Seite, dort findest du nur das hier https://discord.com/developers/docs/topics/rate-limits#rate-limits wo nur von einem pro ip oder pro bot token limit gesprochen wird.

So, es gibt ein Cloudflare rate limit von 50 requests pro IP pro Sekunde über alle requests. Außerdem wird hier von einem limit pro ip und path gesprochen jedoch nicht gesagt wie hoch dieser ist: https://stackoverflow.com/questions/59117210/discord-webhook-rate-limits . Außerdem findest du über dieses limit nach meiner Recherche nichts auf der discord developer Seite, dort findest du nur das hier https://discord.com/developers/docs/topics/rate-limits#rate-limits wo nur von einem pro ip oder pro bot token limit gesprochen wird.
YoyoNow marked this conversation as resolved
YoyoNow added 1 commit 2025-04-14 09:14:10 +02:00
Move 'maxNumberOfWebhooks' constructor parameter to end of list
All checks were successful
SteamWarCI Build successful
e1bcdd59ba
YoyoNow added 1 commit 2025-04-14 09:16:09 +02:00
Fix comment
All checks were successful
SteamWarCI Build successful
5b3c3f36b4
Lixfel approved these changes 2025-04-16 19:42:21 +02:00
YoyoNow merged commit cbaacd4e85 into main 2025-04-16 20:16:52 +02:00
YoyoNow deleted branch VelocityCore/ImproveDiscordChannel 2025-04-16 20:16:52 +02:00
Sign in to join this conversation.
No description provided.