Skip to content

Commit

Permalink
improve naming and interpretation of retries in certificate gathering
Browse files Browse the repository at this point in the history
  • Loading branch information
danthe1st committed Dec 1, 2024
1 parent 0270ca1 commit 23da223
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ public class AuthorityChecker {
private static final Pattern HIERARCHICAL_URI_PATTERN = Pattern
.compile("((?:[^/:]+):(?://[^/]+|///|/)?)([^?#]*)([#?].*)?"); //$NON-NLS-1$

private static final int REQUEST_TIMEOUT_MS = Integer.getInteger("org.eclipse.equinox.p2.engine.requestTimeout", 5000); //$NON-NLS-1$
private static final int REQUEST_TIMEOUT_MS = Integer
.getInteger("org.eclipse.equinox.p2.engine.certificateRequestTimeout", 5000); //$NON-NLS-1$

private static final int MAX_REQUEST_RETRIES = Integer.getInteger("org.eclipse.equinox.p2.engine.requestRetries", //$NON-NLS-1$
2);
private static final int MAX_REQUEST_RETRIES = Integer.getInteger(
"org.eclipse.equinox.p2.engine.certificateRequestRetries", //$NON-NLS-1$
3);

private final IProvisioningAgent agent;
private final ProvisioningContext context;
Expand Down Expand Up @@ -295,7 +297,7 @@ public static void gatherCertificates(Map<URI, List<Certificate>> authorities, I
private static CompletableFuture<HttpResponse<String>> sendHttpRequestOrRetry(HttpClient client,
HttpRequest request, int retriesLeft) {
var future = client.sendAsync(request, BodyHandlers.ofString());
if (retriesLeft > 0) {
if (retriesLeft > 1) {
future = future.exceptionallyComposeAsync(e -> sendHttpRequestOrRetry(client, request, retriesLeft - 1));
}
return future;
Expand Down

0 comments on commit 23da223

Please sign in to comment.