#Ratelimits, Queues and other questions.

1 messages · Page 1 of 1 (latest)

silver junco
#

Hi, I have a few questions about the ratelimit handing, queues and invalid request bucket code.

First of all, do interactions go into the same queue as other requests such as getting a channel. If they do how can this be circumvented as those requests do not fall under the same global ratelimit as mentioned in the docs.

Secondly, what is the invalid request bucket, what is the point of it? Will it automatically prevent making invalid requests or is it to just store endpoints? I currently have a system that checks if a resource, such as channels/roles, is invalid and block the request however I am wondering if there is a better way to do this utilising the invalid request bucket.

vague marsh
# silver junco Hi, I have a few questions about the ratelimit handing, queues and invalid reque...

do interactions go into the same queue as other requests such as getting a channel.
no, i belive they get in a different queue based on the interaction id

what is the invalid request bucket, what is the point of it?
Avoid the Cloudflare ban. Discord will do ban the ip IF their api responds 10k times with 400, 429* or 403

ill it automatically prevent making invalid requests or is it to just store endpoints?
If you reach 10k it will prevent any request to discord until the headers it got tells it that are safe and unbanned

*: Shared ratelimits do not count, however most stuff is token / ip based

silver junco
#

So basically the invalid request is just counted in the bucket and sits near the front of the makeRequest function only intervening when it reaches 10k requests however it will not actually stop requests that could still be invalid.

Do 404 requests not count as invalid? I feel like it should.

#

If I wanted to implement something that would intervene in a more organised approach to my current method caching invalid channels, is there a way I can check this invalidRequests queue or is it internal only

vague marsh
vague marsh
silver junco
#

We already proxy the rest manager as it is so in the seperate rest process we just put a function that checks if its invalid infront of sending the request further to discordeno

#

But what I would like to do is match requests coming in to ones found in the invalidRequests queue

#

so I can mark it as invalid and not actually make the request again

vague marsh
silver junco
#

Okay that makes sense

vague marsh
#

we only store the number of times an invalid request got sent (and discord responded with one of those status code)

  • other metadata for the count (max, the ammount to be safe (1) the interval and so on)
silver junco
#

Okay so really I need to have my own implementation just based off of errors

whole reef
silver junco
#

Gotcha