Add short circuit to MaxMindUtils until we can fix (with timeout + circuit breaker)
This commit is contained in:
parent
a6e31129e9
commit
9043abfa72
@ -21,6 +21,11 @@ public class MaxMindUtils {
|
|||||||
private static final HttpClient httpsClient = APIv3.getVertxInstance().createHttpClient(new HttpClientOptions().setSsl(true).setTrustAll(true));
|
private static final HttpClient httpsClient = APIv3.getVertxInstance().createHttpClient(new HttpClientOptions().setSsl(true).setTrustAll(true));
|
||||||
|
|
||||||
public static void getInsights(String ip, SingleResultCallback<MaxMindResult> callback) {
|
public static void getInsights(String ip, SingleResultCallback<MaxMindResult> callback) {
|
||||||
|
if (1 == 1) {
|
||||||
|
callback.onResult(null, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String authHeader = "Basic " + Base64.getEncoder().encodeToString((maxMindUserId + ":" + maxMindLicenseKey).getBytes(Charsets.UTF_8));
|
String authHeader = "Basic " + Base64.getEncoder().encodeToString((maxMindUserId + ":" + maxMindLicenseKey).getBytes(Charsets.UTF_8));
|
||||||
|
|
||||||
httpsClient.get(443, "geoip.maxmind.com", "/geoip/v2.1/insights/" + ip, (response) -> {
|
httpsClient.get(443, "geoip.maxmind.com", "/geoip/v2.1/insights/" + ip, (response) -> {
|
||||||
@ -38,6 +43,7 @@ public class MaxMindUtils {
|
|||||||
response.exceptionHandler((error) -> callback.onResult(null, error));
|
response.exceptionHandler((error) -> callback.onResult(null, error));
|
||||||
})
|
})
|
||||||
.putHeader("Authorization", authHeader)
|
.putHeader("Authorization", authHeader)
|
||||||
|
.setTimeout(1000)
|
||||||
.end();
|
.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user