Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f58f159

Browse filesBrowse files
committed
Fake a big rate limit
This fixes issue hub4j#78
1 parent a071f8b commit f58f159
Copy full SHA for f58f159

File tree

Expand file treeCollapse file tree

1 file changed

+11
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-1
lines changed

‎src/main/java/org/kohsuke/github/GitHub.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GitHub.java
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
import java.io.File;
2929
import java.io.FileInputStream;
30+
import java.io.FileNotFoundException;
3031
import java.io.IOException;
3132
import java.io.Reader;
3233
import java.net.MalformedURLException;
@@ -239,7 +240,16 @@ public void setConnector(HttpConnector connector) {
239240
* Gets the current rate limit.
240241
*/
241242
public GHRateLimit getRateLimit() throws IOException {
242-
return retrieve().to("/rate_limit", JsonRateLimit.class).rate;
243+
try {
244+
return retrieve().to("/rate_limit", JsonRateLimit.class).rate;
245+
} catch (FileNotFoundException e) {
246+
// GitHub Enterprise doesn't have the rate limit, so in that case
247+
// return some big number that's not too big.
248+
// see issue #78
249+
GHRateLimit r = new GHRateLimit();
250+
r.limit = r.remaining = 1000000;
251+
return r;
252+
}
243253
}
244254

245255
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.