diff --git a/opa-services/src/main/java/io/github/open_policy_agent/opa/plugins/BundleDownloader.java b/opa-services/src/main/java/io/github/open_policy_agent/opa/plugins/BundleDownloader.java index 7d52935..1b5d43c 100644 --- a/opa-services/src/main/java/io/github/open_policy_agent/opa/plugins/BundleDownloader.java +++ b/opa-services/src/main/java/io/github/open_policy_agent/opa/plugins/BundleDownloader.java @@ -50,8 +50,8 @@ public abstract class BundleDownloader { protected String service; protected String resource; protected Config.PollingConfig polling; - protected String etag; - protected long lastModifiedTime = 0; + protected volatile String etag; + protected volatile long lastModifiedTime = 0; protected long maxSizeBytes = Config.BundleConfig.DEFAULT_MAX_SIZE_BYTES; // Fallback when no service config is available; matches the response_header_timeout_seconds @@ -349,14 +349,10 @@ private CompletableFuture handleHttpDownload(URI uri) { HttpRequest request = requestBuilder.build(); - CompletableFuture> exchange = - httpClient.sendAsync(request, HttpResponse.BodyHandlers.ofInputStream()); - return exchange + return httpClient + .sendAsync(request, HttpResponse.BodyHandlers.ofInputStream()) .handle( (response, throwable) -> { - if (throwable != null) { - exchange.cancel(true); - } handleHttpResponse(response, throwable); return null; });