Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused GitHub cache #504

Merged
merged 1 commit into from
Apr 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/main/java/io/jenkins/update_center/GitHubSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io.jenkins.update_center.util.Environment;
import net.sf.json.JSONObject;
import okhttp3.Cache;
import okhttp3.Credentials;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
Expand All @@ -11,7 +10,6 @@
import okhttp3.ResponseBody;

import javax.annotation.CheckForNull;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -29,7 +27,6 @@ public class GitHubSource {

private static String GITHUB_API_USERNAME = Environment.getString("GITHUB_USERNAME");
private static String GITHUB_API_PASSWORD = Environment.getString("GITHUB_PASSWORD");
private static File GITHUB_API_CACHE = new File(Environment.getString("GITHUB_CACHEDIR", "caches/github"));

private Set<String> repoNames;
private Map<String, List<String>> topicNames;
Expand Down Expand Up @@ -62,9 +59,7 @@ protected void initializeOrganizationData(String organization) throws IOExceptio
this.repoNames = new TreeSet<>(String::compareToIgnoreCase);

LOGGER.log(Level.INFO, "Retrieving GitHub repo data...");
Cache cache = new Cache(GITHUB_API_CACHE, 20L * 1024 * 1024); // 20 MB cache
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.cache(cache);
if (GITHUB_API_USERNAME != null && GITHUB_API_PASSWORD != null) {
builder.authenticator((route, response) -> {
String credential = Credentials.basic(GITHUB_API_USERNAME, GITHUB_API_PASSWORD);
Expand Down