Infinite Rate Limit & Global(...) ?
So I had an occurance of my bot not working due to rateImiting.
Pictured are the overall occurance of the RLs, the initial message send occurance, and the first of the 12 following RLs but this time for interaction callback.
https://srcb.in/ef0BLdsEyx
Any thoughts?
The message send appears to be my message send on command use for a particuarly high-usage slash command.
SourceBin
Interaction Rate Limits
28 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
DJS v14.7.1
Node v16.19.0
I'm particuarly curious why the second one says
Global(POST:/.../callback)
but is flagged as global: false
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yea looks like nobody has any input or thoughts
@ckohen probably you can answer this
Ok, so that question about why it says Global but isn’t a global rate limit is good, and is semi related to an issue open in api docs. The Global buckets are for things that don’t have a major id to bucket off of, so in that sense they share one global rate limit for the entire route. The global rate limit indicator tells us if you hit a 429 that was actually global (we have recently learned is not so global) or the 50/s cap is about to be hit and we preemptively stall the request. So while it’s a global bucket (across all servers and such) the rate limit can still be local (only that route).
Some of that needs to be fixed and that is being worked on
Now what I don’t understand is how the callback is being locally ratelimited. As far as I can remember, each callback is currently in its own handler (yikes, this is being fixed too) meaning it should never have a chance to hit a local ratelimit. I have a few wacky theory about what might be able to happen, but pretty sure it can’t, so I’ll tell you that later if I find out it can happen in the code
@ckohen
Excellent thanks, it's concerning as it killed all commands for my bot due to Rate Limits even though it doesn't get anywhere near 50/s
If I can help in anyway, please shout.
@syjalo I appreciste yanking ckohen in 🙂
Oh, by the way the highlighted line with limit: Infinity is saying that the handler has no request limit (which is why it’s so weird that it hit one), not that the timeout is infinite
Ah thanks for the clarification
We’re going to be implementing a special handler for interaction callbacks that should solve most of this problem.
Legendary, thankfully the issue doesn't seem to have happened again
It happened again today, makes my bot hang entierly...
Is there a way to disable retry...if retry on RL is a thing...
you tell the reject on rate limit handler to throw
I'll add thsy tomorrow, I already do it for crossposts, thought I'd make sure
Made a change to do so in addition to my crosspost throw:
.limit isn't how long the ratelimit is, its the maximum number of requests before you hit the ratelimit
Ok...but if I get a RateLimit rejection of limit infinity, then it will throw it and stop looping.
Is there a reason I wouldn't want to throw one which has an infinite limit?
Or can you suggest a better criteria?
it works, just thought you'd specifically call out callback
but actually, feel free to let us now if that is thrown any other time
would be good to know
Cool shall do 👍
So it's been a hot minute since I removed sending log messages for the highly used function and all seems fine, so I guess something was going on there...
@meatbuck
You've got the same issue I had
https://discord.com/channels/222078108977594368/1065377076791742505/1065631142771970048
@ckohen
This dude in another thread can reliably create the Infinity issue locally (with non-callback)
That’s not an issue at all. That’s behaving correctly. As i said before having infinity limit means there is no “local” ratelimit on the endpoint. Which will be true for most GET requests.
Webhooks have some interesting shared ratelimits
Ok, so why does the RL trigger at all?
I still don't understand whst this RL is
It’s a shared ratelimit, there is no indication of why it happens. Discord does not punish these requests.
So it's bascially a rogue rate limit without an explanation or an actual rate limit timeout?
Timeout exists, it’s listed as timeToReset. But we don’t know anything else about it
So the reset for them in 50ms
Same for me
yes
Alright cool.
So 50ms RL with no explanation as to why, what a bugger
Damn, it happened again:
This time an Autocomplete
Followed by the command itself:
🫥
And finally a message send for when the command errors itself, which crashed the bot and I now protect against:
again todsy 😐
Yea recapping my mind on what was up.
Super weird, happened to my log channel post and it wss the only one at the time.
Super curious.