-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposal] Response Header with X-Rate-Limit-Count #119
Comments
I favor this idea, have the same problem here 😉 |
i'd like to have that too, but im dont have enough time to do that right now :/ |
What do you have in mind @alabama @danijoo? Some endpoint won't return One option is to add a condition and new exception when checking for request errors in if ($response->getCode() === 429 && !$response->hasHeader('Retry-After')) {
throw new UnderlyingServiceRateLimitReached('...');
}
class UnderlyingServiceRateLimitReached extends HttpServerError {} but that would require adding header information to Then you should be able to handle this special case in your code by for example creating auto-retry method class RequestUtils
{
public static function autoRetry(callable $f)
{
try {
$f();
} catch (UnderlyingServiceRateLimitReached $e) {
sleep(2);
static::autoRetry($f);
} catch (...) { ... }
}
} |
I merged your pull request. Maybe you can even extend this so public static function autoRetry(callable $f)
{
try {
$f();
} catch (UnderlyingServiceRateLimitReached $e) {
sleep($e->getRetryAfter());
static::autoRetry($f);
} catch (...) { ... }
} |
You mean |
yes :) |
yes :) Michal Baumgartner [email protected] schrieb am Do., 20. Okt. 2016
|
Hey,
what do you guys think to add header information to the client response class? With that information you can improve the limit process. The API returns header information described here: https://developer.riotgames.com/docs/rate-limiting
The real problem i run into was this: https://developer.riotgames.com/discussion/community-discussion/show/VeazJAgi
RiotSchmick (NA) describes, that you can get a 429 but without the "Retry-After" header information, which means that the league of legends service itself had a problem serving the requested data. For me this issue occurred very often in the matchlist and specific match request.
So what do you think about adding header information into the Response class and handling this "429 Response Error" different?
The text was updated successfully, but these errors were encountered: