You are here

public static function Messaging_Store::process_limits in Messaging 6.4

Calculate limits for queue processing

1 call to Messaging_Store::process_limits()
Messaging_Store::queue_process in includes/messaging_store.class.inc
Process and send messages in queue, to be called from cron

File

includes/messaging_store.class.inc, line 83
Database storage for the messaging framework

Class

Messaging_Store
Default storage and queueing system for Messaging

Code

public static function process_limits($limits = array()) {
  $limits += variable_get('messaging_process_limit', array(
    'message' => 0,
    'time' => 0,
    'percent' => MESSAGING_DEFAULT_CRON_PERCENT,
  ));

  // Calculate time limit. We get the smaller of all these times in seconds
  if (!empty($limit['timeout'])) {
    $times[] = $limit['timeout'];
  }
  if (!empty($limit['time'])) {
    $times[] = time() + $limit['time'];
  }
  if (!empty($limit['percent'])) {
    $times[] = time() + ini_get('max_execution_time') * $limit['percent'] / 100;
  }
  $limits['timeout'] = !empty($times) ? min($times) : 0;
  return $limits;
}