Fixed rate handling limit handling

Issue #220. If RateLimitHandler returns normally, it should retry.
This commit is contained in:
Kohsuke Kawaguchi
2015-12-02 12:03:39 +01:00
parent 8cb7094803
commit 83ffe75baa
2 changed files with 9 additions and 0 deletions

View File

@@ -501,6 +501,7 @@ class Requester {
if ("0".equals(uc.getHeaderField("X-RateLimit-Remaining"))) {
root.rateLimitHandler.onError(e,uc);
return;
}
InputStream es = wrapStream(uc.getErrorStream());

View File

@@ -1,4 +1,5 @@
import org.kohsuke.github.GHRepository;
import org.kohsuke.github.GHUser;
import org.kohsuke.github.GitHub;
import java.util.Collection;
@@ -14,4 +15,11 @@ public class Foo {
}
System.out.println(lst.size());
}
private static void testRateLimit() throws Exception {
GitHub g = GitHub.connectAnonymously();
for (GHUser u : g.getOrganization("jenkinsci").listMembers()) {
u.getFollowersCount();
}
}
}