? boost-538460.5.patch ? boost-538460.6.patch Index: boost.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.module,v retrieving revision 1.3.2.2.2.5.2.89 diff -u -p -r1.3.2.2.2.5.2.89 boost.module --- boost.module 6 Aug 2009 08:30:14 -0000 1.3.2.2.2.5.2.89 +++ boost.module 6 Aug 2009 14:50:08 -0000 @@ -1973,26 +1973,15 @@ function boost_crawler_init() { // Start to do crawler stuff else { if (boost_crawler_init_tables()) { - $start = variable_get('boost_crawler_position', 0); - $count = db_result(db_query('SELECT COUNT(*) FROM {boost_crawler}')); - if ($count <= $start) { - // Crawler done; - watchdog('boost', 'Crawler Done'); - return TRUE; - } - //Spin Up Threads $thread_primed = variable_get('boost_crawler_threads_primed', FALSE); - $threads = 2; //variable_get('boost_crawler_threads', 4); + $threads = 2; if (!$thread_primed) { variable_set('boost_crawler_threads_primed', TRUE); - //variable_set('boost_crawler_threads_loaded', FALSE); while ($threads > 0) { - //watchdog('boost', 'Thread started ' . $threads); $threads--; boost_async_call_crawler($self); } - //variable_set('boost_crawler_threads_loaded', TRUE); watchdog('boost', 'All threads started'); exit; } @@ -2003,21 +1992,26 @@ function boost_crawler_init() { exit; } - // Wait for all threads to be loaded before continuing. - //$loaded = unserialize(db_result(db_query("SELECT value FROM {variable} WHERE name = 'boost_crawler_threads_loaded'"))); - //while (!$loaded) { - // sleep(1); - // $loaded = unserialize(db_result(db_query("SELECT value FROM {variable} WHERE name = 'boost_crawler_threads_loaded'"))); - //} - - $step = variable_get('boost_crawler_step', 25); - $start = unserialize(db_result(db_query("SELECT value FROM {variable} WHERE name = 'boost_crawler_position'"))); - variable_set('boost_crawler_position', $start + $step); - - $results = db_query_range("SELECT url FROM {boost_crawler} ORDER BY id ASC", $start, $step); - while ($url = db_fetch_array($results)) { + $step = 25; + // Wait 0 to 3 seconds before grabing DB position counter. + usleep(mt_rand(0,3000000)); + $from = unserialize(db_result(db_query("SELECT value FROM {variable} WHERE name = 'boost_crawler_position'"))); + variable_set('boost_crawler_position', ($from + $step)); + + $results = db_query_range("SELECT url FROM {boost_crawler} ORDER BY id ASC", $from, $step); + $url = db_result($results); + if (!$url) { + watchdog('boost', 'Crawler Done'); + return TRUE; + } + else { drupal_http_request($url['url']); - //watchdog('boost', $url['url']); + //watchdog('boost', $url); + set_time_limit(0); + } + while ($url = db_result($results)) { + drupal_http_request($url); + //watchdog('boost', $url); set_time_limit(0); } // Crawler for this round done, call self and exit