From 3509b54a341c769d9f80a45a5b9856e7fbd17961 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Thu, 2 Jun 2011 01:40:20 +0000
Subject: [PATCH] In case of exceptions, retry up to 10 times.

---
 exec/load/geoip.js | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/exec/load/geoip.js b/exec/load/geoip.js
index ddacc47cf7..b4a8ee1ef2 100644
--- a/exec/load/geoip.js
+++ b/exec/load/geoip.js
@@ -58,17 +58,20 @@ function get_geoip(host, countryonly)
 		else
 			geoip_url='http://api.ipinfodb.com/v3/ip-city/?key='+geoipAPIKey+'&format=json&ip='+encodeURIComponent(host);
 	}
-	try {
-		do {
-			result='ret='+new HTTPRequest().Get(geoip_url);
-			GeoIP=js.eval(result);
-		} while(GeoIP==undefined);
-		if(GeoIP.Locations != undefined) {
-			if(isarray)
-				return GeoIP.Locations;
-			return GeoIP.Locations[0];
+	for(i=0; i<10; i++) {
+		try {
+			do {
+				result='ret='+new HTTPRequest().Get(geoip_url);
+				GeoIP=js.eval(result);
+			} while(GeoIP==undefined);
+			if(GeoIP.Locations != undefined) {
+				if(isarray)
+					return GeoIP.Locations;
+				return GeoIP.Locations[0];
+			}
+			return GeoIP;
+		}
+		catch(e) {
 		}
-		return GeoIP;
 	}
-	catch(e) {}
 }
-- 
GitLab