Fixes how search_controller check if a mirror is alive, a=chris

Chris Pollett [2015-01-17 02:Jan:th]
Fixes how search_controller check if a mirror is alive, a=chris
Filename
configs/config.php
controllers/search_controller.php
diff --git a/configs/config.php b/configs/config.php
index 597297bdc..746618ca0 100755
--- a/configs/config.php
+++ b/configs/config.php
@@ -59,6 +59,18 @@ define('QUERY_INFO', 2);
 define('ERROR_INFO', 4);
 /** Maintenance mode restricts access to local machine*/
 define("MAINTENANCE_MODE", false);
+/** Constant used to indicate lasting an arbitrary number of seconds */
+define('FOREVER', -2);
+/** Number of seconds in a day*/
+define('ONE_DAY', 86400);
+/** Number of seconds in a week*/
+define('ONE_WEEK', 604800);
+/** Number of seconds in a 30 day month */
+define('ONE_MONTH', 2592000);
+/** Number of seconds in an hour */
+define('ONE_HOUR', 3600);
+/** Number of seconds in a minute */
+define('ONE_MINUTE', 60);
 if(file_exists(BASE_DIR."/configs/local_config.php")) {
     /** Include any locally specified defines (could use as an alternative
         way to set work directory) */
@@ -321,7 +333,7 @@ define("NUMBER_OF_LOG_FILES", 5);
  * how long in seconds to keep a cache of a robot.txt
  * file before re-requesting it
  */
-define('CACHE_ROBOT_TXT_TIME', 86400);
+define('CACHE_ROBOT_TXT_TIME', ONE_DAY);
 /**
  * Whether the scheduler should track ETag and Expires headers.
  * If you want to turn this off set the variable to false in
@@ -436,7 +448,7 @@ define('ARCHIVE_BATCH_SIZE', 100);
 /** time in seconds before we give up on multi page requests*/
 define('PAGE_TIMEOUT', 30);
 /** time in seconds before we give up on a single page request*/
-define('SINGLE_PAGE_TIMEOUT', 60);
+define('SINGLE_PAGE_TIMEOUT', ONE_MINUTE);
 /** max time in seconds in a process before write a log message if
     crawlTimeoutLog is called repeatedly from a loop
  */
@@ -445,7 +457,7 @@ define('LOG_TIMEOUT', 30);
  * Maximum time a crawl daemon process can go before calling
  * @see CrawlDaemon::processHandler
  */
-define('PROCESS_TIMEOUT', 240);
+define('PROCESS_TIMEOUT', 4 * ONE_MINUTE);
 /**
  * Number of error page 400 or greater seen from a host before crawl-delay
  * host and dump remainder from current schedule
@@ -573,13 +585,13 @@ define ('FETCH_SLEEP_TIME', 10);
 /** an a queue_server minimum loop idle time*/
 define ('QUEUE_SLEEP_TIME', 5);
 /** How often mirror script tries to synchronize with machine it is mirroring*/
-define ('MIRROR_SYNC_FREQUENCY', 3600);
+define ('MIRROR_SYNC_FREQUENCY', ONE_HOUR);
 /** How often mirror script tries to notify machine it is mirroring that it
 is still alive*/
-define ('MIRROR_NOTIFY_FREQUENCY', 60);
+define ('MIRROR_NOTIFY_FREQUENCY', ONE_MINUTE);
 /** Max time before dirty index (queue_server) and
     filters (fetcher) will be force saved in seconds*/
-define('FORCE_SAVE_TIME', 3600);
+define('FORCE_SAVE_TIME', ONE_HOUR);
 /** Number of seconds of no fetcher contact before crawl is deemed dead*/
 define("CRAWL_TIME_OUT", 1800);
 /** maximum number of terms allowed in a conjunctive search query */
@@ -592,10 +604,10 @@ define ('NUM_RESULTS_PER_PAGE', 10);
 define ('NUM_RECENT_URLS_TO_DISPLAY', 10);
 /** Maximum time a set of results can stay in query cache before it is
     invalidated */
-define ('MAX_QUERY_CACHE_TIME', 2 * 86400); //two days
+define ('MAX_QUERY_CACHE_TIME', 2 * ONE_DAY); //two days
 /** Minimum time a set of results can stay in query cache before it is
     invalidated */
-define ('MIN_QUERY_CACHE_TIME', 3600); //one hour
+define ('MIN_QUERY_CACHE_TIME', ONE_HOUR); //one hour
 /**
  * Default number of items to page through for users,roles, mixes, etc
  * on the admin screens
@@ -706,19 +718,6 @@ define('STANDARD_GROUP_ITEM', 0);
  *  page so that people can discuss the pages contents
  */
 define('WIKI_GROUP_ITEM', 1);
-
-/** Constant used to indicate lasting an arbitrary number of seconds */
-define('FOREVER', -2);
-/** Number of seconds in a day*/
-define('ONE_DAY', 86400);
-/** Number of seconds in a week*/
-define('ONE_WEEK', 604800);
-/** Number of seconds in a 30 day month */
-define('ONE_MONTH', 2592000);
-/** Number of seconds in an hour */
-define('ONE_HOUR', 3600);
-/** Number of seconds in a minute */
-define('ONE_MINUTE', 60);
 /*
  * Database Field Sizes
  */
diff --git a/controllers/search_controller.php b/controllers/search_controller.php
index 5c6f10dc1..ac2f45672 100755
--- a/controllers/search_controller.php
+++ b/controllers/search_controller.php
@@ -569,7 +569,7 @@ class SearchController extends Controller implements CrawlConstants
             $mirrors = array();
             $time = time();
             foreach($mirror_table['machines'] as $entry) {
-                if($time - $entry[3] < 2 * MIRROR_NOTIFY_FREQUENCY) {
+                if($time - $entry[2] < 2 * MIRROR_NOTIFY_FREQUENCY) {
                     if($entry[0] == "::1") {
                         $entry[0] = "[::1]";
                     }
ViewGit