You are here

function feedapi_cron_time in FeedAPI 5

Same name and namespace in other branches
  1. 6 feedapi.module \feedapi_cron_time()

Check for time limits in cron processing.

Return value

Number of seconds left, zero if none.

2 calls to feedapi_cron_time()
feedapi_cron in ./feedapi.module
Implementation of hook_cron().
_feedapi_invoke_refresh in ./feedapi.module
Helper function for feedapi_invoke(). Refresh the feed, call the proper parsers and processors' hooks. Don't call this function directly, use feedapi_refresh() instead.

File

./feedapi.module, line 650
Handle the submodules (for feed and item processing) Provide a basic management of feeds

Code

function feedapi_cron_time() {
  static $time_limit;
  if (!$time_limit) {
    $time_limit = time() + variable_get('feedapi_cron_percentage', 15) / 100 * ini_get('max_execution_time');

    // However, check for left time, maybe some other cron processing already occured
    $time_limit = min($time_limit, variable_get('cron_semaphore', 0) + ini_get('max_execution_time'));
    timer_start('feedapi_cron');
  }
  return max($time_limit - time(), 0);
}