浏览代码

`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 年之前
父节点
当前提交
18e0d187ca
共有 1 个文件被更改,包括 4 次插入4 次删除
  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));
 				}