Open rxdn opened 3 years ago
There is an invalid request limit of 10_000/10 minutes that will ban you for an hour when you reach it. Maybe twilight should stop sending requests after e.g. 9_999 invalid requests to prevent getting globally rate limited for one hour too.
Wouldn't hard-coding, even an over-writable, value would go against Discord's recommendations of using dynamic ratelimits? The cloudflare limit is however a sound exception
I think hardcoding but allowing to override the global rate limit is fine since it's explicitly documented at https://discord.com/developers/docs/topics/rate-limits#global-rate-limit
Cloudflare ones could be nice if we ensure it excludes the shared rate limits
From my understanding from our discussion in Discord,
global ratelimits are not handled by the http module's ratelimiting function.more than the global ratelimit bucket's worth of requests may be sent at once, due to not being able to know the size and reset rate of the ratelimit bucket.Discord assigns everyone a global cap of 50 requests per second, which can be increased after the requirements for large sharding are met or under exceptional circumstances, so it would be safe to impose a default limit of 50, unless the user provides their own limit to override with.
*EDIT: corrected first statement. Additionally, this means we will be hard-coding information that Discord does not provide, so we need to consider if this is something we want to do or, at the least, provide some sort of "cap" on in-flight requests.