If we are a returning a collection of all things, we might as well use the maximum page size to minimize HTTP requests.

This commit is contained in:
Jesse Glick
2016-09-19 09:48:23 -07:00
parent df963cb71c
commit 38983df42d
2 changed files with 2 additions and 2 deletions

View File

@@ -220,7 +220,7 @@ public class GHOrganization extends GHPerson {
*/
public List<GHRepository> getRepositoriesWithOpenPullRequests() throws IOException {
List<GHRepository> r = new ArrayList<GHRepository>();
for (GHRepository repository : listRepositories()) {
for (GHRepository repository : listRepositories(100)) {
repository.wrap(root);
List<GHPullRequest> pullRequests = repository.getPullRequests(GHIssueState.OPEN);
if (pullRequests.size() > 0) {

View File

@@ -52,7 +52,7 @@ public abstract class GHPerson extends GHObject {
*/
public synchronized Map<String,GHRepository> getRepositories() throws IOException {
Map<String,GHRepository> repositories = new TreeMap<String, GHRepository>();
for (GHRepository r : listRepositories()) {
for (GHRepository r : listRepositories(100)) {
repositories.put(r.getName(),r);
}
return Collections.unmodifiableMap(repositories);