Better type safety by splitting RateLimitHandler and AbuseLimitHandler

While the signature is the same, headers that they expect are different,
so any non-trivial logic cannot be reused.
This commit is contained in:
Kohsuke Kawaguchi
2016-08-05 19:58:04 -07:00
parent 9f5a6ee549
commit 856cf5e568
5 changed files with 74 additions and 28 deletions

View File

@@ -572,10 +572,9 @@ class Requester {
root.rateLimitHandler.onError(e,uc);
return;
}
// Check to see whether we hit a 403, and the Retry-After field is
// available.
if (responseCode == HttpURLConnection.HTTP_FORBIDDEN &&
// Retry-After is not documented but apparently that field exists
if (responseCode == HttpURLConnection.HTTP_FORBIDDEN &&
uc.getHeaderField("Retry-After") != null) {
this.root.abuseLimitHandler.onError(e,uc);
return;