Add short circuit to MaxMindUtils until we can fix (with timeout + circuit breaker)

This commit is contained in:
Colin McDonald 2016-07-09 17:23:34 -04:00
parent a6e31129e9
commit 9043abfa72
1 changed files with 6 additions and 0 deletions

View File

@ -21,6 +21,11 @@ public class MaxMindUtils {
private static final HttpClient httpsClient = APIv3.getVertxInstance().createHttpClient(new HttpClientOptions().setSsl(true).setTrustAll(true));
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));
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));
})
.putHeader("Authorization", authHeader)
.setTimeout(1000)
.end();
}