Closed KnightNiwrem closed 6 months ago
Rate limits are enforced on a per-method basis. They may affect each other indirectly, but we should delay all calls to the same method—not session key.
Amazing work btw!
Fixed.. I think?
@KnightNiwrem how well did you test this?
This is not a good idea. For examples, responses to messages might still be sent while broadcasting is slowed down. It makes sense to keep unrelated API call independent, and not apply rate limits of one call to other calls.
Bot developers need to make sure that they don't call a method too many times concurrently.
If 429 is triggered by some API call in a middleware or some other independent setTimeout call, other async threads that uses the same sessionKey (i.e. bot api token or id) shall also be aware of the recalculated retry_after value.
This attempts to ensure the 429 -> stop all calls until.. -> start sending model.