Why is status OVER_QUERY_LIMIT running before Status.OK? I use this code:
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
var response = Math.ceil(response.routes[0].legs[0].distance.value / 1000);
stores.push({
distance: response,
id: item.properties.Nid,
});
console.log('STATUS.OK');
} else if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT){
console.log('OVER_QUERY_LIMIT');
}
});
Status OVER_QUERY_LIMIT is logged before the STATUS.OK. I know that OVER_QUERY_LIMIT is running because I did to many requests.
But I can't figure how I could create a delay when OVER_QUERY_LIMIT is always running first.
Can someone explain it to me please?