Skip to content

Commit

Permalink
Adding logging, and hash map
Browse files Browse the repository at this point in the history
  • Loading branch information
avimanyum committed Nov 5, 2021
1 parent 791d08f commit 8d806a7
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import java.io.*;
import java.util.*;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;

/**
Expand Down Expand Up @@ -140,6 +141,10 @@ public Optional<List<PagedSearchIterable<GHContent>>> findFilesWithImage(
log.warn("Number of search results for a single org {} is above {}! The GitHub Search API will only return around 1000 results - https://developer.github.com/v3/search/#about-the-search-api",
orgName, gitApiSearchLimit);
} else if (totalCount > gitApiSearchLimit) {
log.info("The number of files returned is greater than the git API search limit" +
" of {}. The orgs with the maximum number of hits will be recursively removed" +
" to reduce the search space. For every org that is excluded, a separate " +
"search will be performed specific to that org.", gitApiSearchLimit);
return getSearchResultsExcludingOrgWithMostHits(image, files, orgsToIncludeOrExclude, gitApiSearchLimit);
}
List<PagedSearchIterable<GHContent>> filesList = new ArrayList<>();
Expand Down Expand Up @@ -401,7 +406,8 @@ public boolean thisUserIsOwner(GHRepository repo) throws IOException {
public Optional<List<PagedSearchIterable<GHContent>>> getGHContents(String org, String img, Integer gitApiSearchLimit)
throws IOException, InterruptedException {
Optional<List<PagedSearchIterable<GHContent>>> contentsWithImage = Optional.empty();
Map<String, Boolean> orgsToIncludeInSearch = Collections.unmodifiableMap(Collections.singletonMap(org, true));
Map<String, Boolean> orgsToIncludeInSearch = new HashMap<>();
orgsToIncludeInSearch.put(org, true);
for (int i = 0; i < 5; i++) {
contentsWithImage = findFilesWithImage(img, orgsToIncludeInSearch, gitApiSearchLimit);
if (contentsWithImage
Expand Down

0 comments on commit 8d806a7

Please sign in to comment.