Skip to content

Commit f3eff77

Browse files
authored
Merge pull request #19 from rafaeldff/use-failing-rate-limiter
Avoid locking up server threads when rate limited by GitHub
2 parents 5693341 + 6f77169 commit f3eff77

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/cd/go/authorization/github/GitHubClientBuilder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import cd.go.authorization.github.models.AuthenticateWith;
2020
import cd.go.authorization.github.models.GitHubConfiguration;
2121
import org.kohsuke.github.GitHub;
22+
import org.kohsuke.github.GitHubBuilder;
23+
import org.kohsuke.github.RateLimitHandler;
2224

2325
import java.io.IOException;
2426

@@ -36,7 +38,7 @@ private GitHub createGitHub(String accessToken, GitHubConfiguration gitHubConfig
3638
return GitHub.connectToEnterprise(gitHubConfiguration.gitHubEnterpriseUrl(), accessToken);
3739
} else {
3840
LOG.debug("Create GitHub connection to public GitHub with token");
39-
return GitHub.connectUsingOAuth(accessToken);
41+
return new GitHubBuilder().withOAuthToken(accessToken).withRateLimitHandler(RateLimitHandler.FAIL).build();
4042
}
4143
}
4244
}

0 commit comments

Comments
 (0)