Coming from #1111254: Document the Hostmaster API I'd like to document hook_hosting_queues, which boils down to documenting the following array from hosting_get_queues:


    $defaults = array(
      'type' => 'serial', 
      'max_threads' => 6, 
      'threshold' => '100', 
      'min_threads' => 1, 
      'timeout' => strtotime("10 minutes", 0), 
      'frequency' => strtotime("5 minutes", 0), 
      'items' => 5, 
      'enabled' => TRUE, 
      'singular' => t('item'), 
      'plural' => t('items'),
    );

What are the threads about, and what is the 'threshold' about eh?

Comments

omega8cc’s picture

It is used a few lines later in the modules/hosting/hosting.queues.inc

      if ($queue['type'] == 'batch') {
        $threads = $queue['total_items'] / $queue['threshold'];
        if ($threads <= $queue['min_threads']) {
          $threads = $queue['min_threads'];
        } elseif ($thread > $queue['max_threads']) {
          $threads = $queue['max_threads'];
        }
        $queue['calc_threads'] = $threads;
        $queue['calc_frequency'] = ceil($queue['frequency'] / $threads);
        $queue['calc_items'] = ceil($queue['total_items'] / $threads);
      }
omega8cc’s picture

But yeah, reading "the code as documentation" is always easier than "translating code to documentation" :)

steven jones’s picture

Indeed, I think my original questions stand ;)

anarcat’s picture

Category: bug » task

I think the idea of the threshold is that it's a heuristic to determine how many threads we need to fire up to process the tasks in that batch, to avoid going over memory limits and things like that.

For example, hosting_cron allows between 6 and 12 cron jobs to run at a time on one server... Presumably this could be tuned...

ergonlogic’s picture

Version: 6.x-0.4-alpha3 » 7.x-3.x-dev
Issue summary: View changes
helmo’s picture

Status: Active » Closed (won't fix)

The reference is in hosting.api.php, lets not duplicate that defaults code.