Skip to content

Commit

Permalink
Add connectTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil Meitis committed Dec 4, 2024
1 parent b524e67 commit 891476a
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.net.*;
import java.net.http.*;
import java.time.*;
import java.util.*;
import java.util.logging.*;

Expand All @@ -44,7 +45,9 @@ public class AwsCandidateHarvester
* The <tt>HttpClient</tt> used by the <tt>AwsCandidateHarvester</tt>
* class and its instances for making requests to IMDS.
*/
private static final HttpClient httpClient = HttpClient.newHttpClient();
private static final HttpClient httpClient = HttpClient.newBuilder()
.connectTimeout(Duration.ofMillis(500))
.build();

/**
* The URL where one obtains AWS public addresses.
Expand Down

0 comments on commit 891476a

Please sign in to comment.