=== modified file 'includes/common.inc' --- includes/common.inc 2009-09-11 15:12:29 +0000 +++ includes/common.inc 2009-09-16 03:35:29 +0000 @@ -3835,6 +3835,8 @@ function drupal_cron_run() { // Fetch the cron semaphore $semaphore = variable_get('cron_semaphore', FALSE); + + $return = FALSE; if ($semaphore) { if (REQUEST_TIME - $semaphore > 3600) { @@ -3868,8 +3870,18 @@ function drupal_cron_run() { variable_del('cron_semaphore'); // Return TRUE so other functions can check if it did run successfully - return TRUE; + $return = TRUE; } + foreach (module_implements('cron_worker') as $module) { + $function = $module . '_cron_worker'; + $end = time() + variable_get($function, 15); + $queue = DrupalQueue::get($function); + while (time() < $end && ($item = $queue->claimItem())) { + $function($item->data); + $queue->deleteItem($item); + } + } + return $return; } /** === modified file 'modules/aggregator/aggregator.install' --- modules/aggregator/aggregator.install 2009-09-10 06:38:16 +0000 +++ modules/aggregator/aggregator.install 2009-09-16 03:31:42 +0000 @@ -7,6 +7,13 @@ */ /** + * Implement hook_install(). + */ +function aggregator_install() { + DrupalQueue::get('aggregator_cron_worker')->createQueue(); +} + +/** * Implement hook_uninstall(). */ function aggregator_uninstall() { === modified file 'modules/aggregator/aggregator.module' --- modules/aggregator/aggregator.module 2009-08-29 05:46:01 +0000 +++ modules/aggregator/aggregator.module 2009-09-16 03:34:05 +0000 @@ -306,19 +306,29 @@ function aggregator_permission() { /** * Implement hook_cron(). * - * Checks news feeds for updates once their refresh interval has elapsed. + * Queues news feeds for updates once their refresh interval has elapsed. */ function aggregator_cron() { $result = db_query('SELECT * FROM {aggregator_feed} WHERE checked + refresh < :time AND refresh != :never', array( ':time' => REQUEST_TIME, ':never' => AGGREGATOR_CLEAR_NEVER )); + $queue = DrupalQueue::get('aggregator_cron_worker'); foreach ($result as $feed) { - aggregator_refresh($feed); + $queue->createItem($feed); } } /** + * Implement hook_cron_worker(). + * + * Refresh queued news feeds. + */ +function aggregator_cron_worker($feed) { + aggregator_refresh($feed); +} + +/** * Implement hook_block_info(). */ function aggregator_block_info() {