Browse Source

`s/repeats/repeat/g` & defaulting to google recs

defaults changed to 2 repeat @ 2 seconds:

https://developers.google.com/maps/documentation/business/articles/usage_limits

> Upon receiving a response with status code OVER_QUERY_LIMIT, your application should determine which usage limit has been exceeded. This can be done by pausing for 2 seconds and resending the same request. If status code is still OVER_QUERY_LIMIT, your application is sending too many requests per day. Otherwise, your application is sending too many requests per second.

according to their guidelines, you should really only try twice
alan bount 11 years ago
parent
commit
18e0d187ca
1 changed files with 4 additions and 4 deletions
  1. 4 4
      Lib/GeocodeLib.php

+ 4 - 4
Lib/GeocodeLib.php

@@ -61,8 +61,8 @@ class GeocodeLib {
 	 */
 	public $options = array(
 		'log' => false,
-		'pause' => 10000, # in microseconds (10000 = 0.01 seconds)
-		'repeats' => 5, # if over limits, how many times to repeat
+		'pause' => 2000000, # in microseconds (2000000 = 2 seconds = recommended by Google)
+		'repeat' => 2, # if over limits, how many times to repeat
 		'min_accuracy' => self::ACC_COUNTRY,
 		'allow_inconclusive' => true,
 		'expect' => array(), # see accuracyTypes for details
@@ -305,7 +305,7 @@ class GeocodeLib {
 				return false; # for now...
 			}
 
-			if ($count > $this->options['repeats']) {
+			if ($count > $this->options['repeat']) {
 				if ($this->options['log']) {
 					CakeLog::write('geocode', __('Aborted after too many trials with \'%s\'', $address));
 				}
@@ -385,7 +385,7 @@ class GeocodeLib {
 				}
 				return false; # for now...
 			}
-			if ($count > $this->options['repeats']) {
+			if ($count > $this->options['repeat']) {
 				if ($this->options['log']) {
 					CakeLog::write('geocode', __('Aborted after too many trials with \'%s\'', $latlng));
 				}