Skip to content

Commit

Permalink
httpClient created as instance variable
Browse files Browse the repository at this point in the history
  • Loading branch information
PurvaPandyaVyas authored and reimer-atb committed May 24, 2022
1 parent e8ae3bd commit 556ff39
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,19 @@ public class GitlabApiClient {

private static final Logger logger = LoggerFactory.getLogger(GitlabApiClient.class);
private static final DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME;
private static final ZonedDateTime initialSinceDate = ZonedDateTime.of(
2022, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC);
private static final String membershipParam = "&membership=true";
private static final String paginationParam = "&per_page=100";
private static final String refNameParam = "&ref_name=";
private static final String sinceParam = "&since=";
private static final ZonedDateTime initialSinceDate = ZonedDateTime.of(2022, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC);
private static final String uriPartForBranches = "/repository/branches/";
private static final String uriPartForCommits = "/repository/commits/";
private static final String uriPartForDiff = "/diff/";
private static final String uriPartForProjects = "/api/v4/projects/";
private final String baseUri;
private final HttpClient httpClient = HttpClient.newBuilder().version(HttpClient.Version.HTTP_2)
.connectTimeout(Duration.ofMinutes(5)).build();
private final String uriParams;
private ZonedDateTime lastRun = null;

Expand Down Expand Up @@ -178,11 +181,6 @@ private HttpResponse<String> makeGetCallToGitlab(String uri) {

HttpResponse<String> response = null;
try {
final HttpClient httpClient = HttpClient.newBuilder()
.version(HttpClient.Version.HTTP_2)
.connectTimeout(Duration.ofMinutes(5))
.build();

HttpRequest request = HttpRequest.newBuilder().GET().uri(URI.create(uri)).build();

// receive response from Gitlab
Expand Down

0 comments on commit 556ff39

Please sign in to comment.