From 9043abfa72fdb73656c1cde7c3dca374fc9ad84a Mon Sep 17 00:00:00 2001 From: Colin McDonald Date: Sat, 9 Jul 2016 17:23:34 -0400 Subject: [PATCH] Add short circuit to MaxMindUtils until we can fix (with timeout + circuit breaker) --- src/main/java/net/frozenorb/apiv3/util/MaxMindUtils.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/net/frozenorb/apiv3/util/MaxMindUtils.java b/src/main/java/net/frozenorb/apiv3/util/MaxMindUtils.java index 66091e5..be107b3 100644 --- a/src/main/java/net/frozenorb/apiv3/util/MaxMindUtils.java +++ b/src/main/java/net/frozenorb/apiv3/util/MaxMindUtils.java @@ -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 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(); }