Open Marqin opened 8 years ago
So, the simple way to implent:
We could have some "global state" implemented via Agent (or process) that is registered to atom name. And now, when geting REST
reposnse we upgrade that "state" to current rate limit info. And when doing REST
request we can:
if curr_time() < RateLimit.get(:rate_limit, "refresh_time") and RateLimit.get(:rate_limit, "req_left") == 0 do
{:error, "You have been blocked by RateLimit feature."
else
# send our request
end
I could start working on it when we agree on some architecture.
rate limiting:
HTTP
X-RateLimit-Remaining
will tell us how much more requests we can doX-RateLimit-Reset
will tell us when RL timer resetsWS
Game Status:
Gateway connection:
if you hit this limit the Gateway will delay your connection until the cooldown has timed out
RATE LIMITS docs (it's on github, link on web docs is broken)
Discord's dev request for lib developers to handle Rate Limiting properly