Skip to content

Commit 51d5810

Browse files
authored
[JENKINS-71849] Allow NoThrottle to be used even on github.com (#653)
* [JENKINS-68321] Allow `NoThrottle` to be used even on github.com * Ignoring failing tests
1 parent 42897b9 commit 51d5810

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

src/main/java/org/jenkinsci/plugins/github_branch_source/ApiRateLimitChecker.java

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,22 +100,13 @@ long checkRateLimitImpl(@NonNull GHRateLimit.Record rateLimit, long count, long
100100
NoThrottle(Messages.ApiRateLimitChecker_NoThrottle()) {
101101
@Override
102102
public LocalChecker getChecker(@NonNull TaskListener listener, String apiUrl) {
103-
if (GitHubServerConfig.GITHUB_URL.equals(apiUrl)) {
104-
// If the GitHub public API is being used, this will fallback to ThrottleOnOver
105-
LocalChecker checker = ThrottleOnOver.getChecker(listener, apiUrl);
106-
checker.writeLog(
107-
"GitHub throttling is disabled, which is not allowed for public GitHub usage, "
108-
+ "so ThrottleOnOver will be used instead. To configure a different rate limiting strategy, go to \"GitHub API usage\" under \"Configure System\" in the Jenkins settings.");
109-
return checker;
110-
} else {
111-
return new LocalChecker(listener) {
112-
@Override
113-
long checkRateLimitImpl(@NonNull GHRateLimit.Record rateLimit, long count, long now)
114-
throws InterruptedException {
115-
return now;
116-
}
117-
};
118-
}
103+
return new LocalChecker(listener) {
104+
@Override
105+
long checkRateLimitImpl(@NonNull GHRateLimit.Record rateLimit, long count, long now)
106+
throws InterruptedException {
107+
return now;
108+
}
109+
};
119110
}
120111
};
121112

src/test/java/org/jenkinsci/plugins/github_branch_source/ApiRateLimitCheckerTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.jenkinsci.plugins.github.config.GitHubServerConfig;
2828
import org.junit.After;
2929
import org.junit.Before;
30+
import org.junit.Ignore;
3031
import org.junit.Test;
3132
import org.kohsuke.github.GHRateLimit;
3233
import org.kohsuke.github.GitHub;
@@ -159,6 +160,7 @@ private void setupStubs(List<RateLimit> scenarios) throws Exception {
159160
assertEquals(2, initialRequestCount);
160161
}
161162

163+
@Ignore("behavior deliberately modified")
162164
@Test
163165
public void NoCheckerConfigured() throws Exception {
164166
// set up scenarios
@@ -349,6 +351,7 @@ public void NoThrottleTestShouldNotThrottle404() throws Exception {
349351
*
350352
* @author Marc Salles Navarro
351353
*/
354+
@Ignore("behavior deliberately modified")
352355
@Test
353356
public void NoThrottleTestShouldFallbackToThrottleOnOverForGitHubDotCom() throws Exception {
354357
GitHubConfiguration.get().setApiRateLimitChecker(ApiRateLimitChecker.ThrottleOnOver);

0 commit comments

Comments
 (0)