How To Handle Over_query_limit
I am using google maps to draw the path among various location which are stored in database. fiddle While passing 15 geopoints(anything more than 10) am getting status as OVER_QUER
Solution 1:
Google reccomends:
Lowering usage, by optimizing applications to use the web services more efficiently.
Increasing usage limits, when possible, by purchasing additional allowance for your Google Maps API for Work license.
Also HERE there is some workaround that seems to fit what you need in
ifstatus == "OVER_QUERY_LIMIT":
time.sleep(2)
This is written in Phyton, but you can use it as Pseudocode, it's easily readable:
url = "MAPS_API_WEBSERVICE_URL"
attempts = 0
success = Falsewhile success != Trueand attempts < 3:
raw_result = urllib.urlopen(url).read()
attempts += 1# The GetStatus function parses the answer and returns the status code# This function is out of the scope of this example (you can use a SDK).
status = GetStatus(raw_result)
if status == "OVER_QUERY_LIMIT":
time.sleep(2)
# retrycontinue
success = Trueif attempts == 3:
# send an alert as this means that the daily limit has been reachedprint"Daily limit has been reached"
In your javascript
code, simply set a timeout:
if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT)
{
setTimeout(3000);
}
Check the working fiddle
Post a Comment for "How To Handle Over_query_limit"