Skip to content
Snippets Groups Projects
Commit 3509b54a authored by deuce's avatar deuce
Browse files

In case of exceptions, retry up to 10 times.

parent 5b587357
Branches
Tags
No related merge requests found
......@@ -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) {}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment