Take for instance the Queue Mail module.
This module has a 'process queue on cron runs' kind of setting that affects its hook_cron_queue_info() 'skip on cron' setting.

Later, in mob_queue's config screen, since you are only variable_setting('mob_queue_...') setting, you might think that you are disabling process on cron run or be confused about it, at least. It's true that mob_queue runs on hook_cron_queue_info_alter(), but other modules might be also altering it via their own hook_cron_queue_info_alter().

Proposal:

  • Change setting wording to 'Process <em>@name</em> queue under Drush\'s <em>mob-queue-exec</em> and skip queue processing at cron runs.' to clarify that, even if not skipped on cron, the queue processing will be also done from Drush.
  • For queues with 'skip on cron' set to true elsewhere, disable the mob_queue checkbox and add a '(Disabled elsewhere)' or '(Skipped elsewhere)' notice besides the checkbox title to better reflect that there are other involved modules affecting the 'skip on cron' behaviour.
  • Optionally, create separate 'skip on cron' and 'run under mob-queue-exec' settings (they don't need to be mutually exclusive, although it will be the most common scenario). Even further, the module could also offer the ability of completely disable queues by removing them at hook_cron_queue_info_alter(). This could be imlemented as a table/checkbox grid.

I plan to make heavy use of the module in production so I'm ready to provide patches for any improvement. What worries me is the project's maintenance status being 'Maintenance fixes only' and would also like to get feedback on that.

Comments

amontero created an issue.

wuinfo - Bill Wu’s picture

Thanks @amontero. Thanks for the proposals.

even if not skipped on cron, the queue processing will be also done from Drush.

The Drush command from this module will only process the queue tasks selected to skip on cron.

amontero’s picture

Hi, wuinfo.
Thanks for the prompt response.

In my use case, I have all queues set to be skipped on cron, and I run each one with an appropiate "drush queue-run" invocation on another, dedicated, worker server.
However, there are queues that I would like to run all under one 'drush mob-exe-queue' but not all of them. Example:
* queue1, 2 and 3 can be bundled in a mob-exe-queue execution.
* queue4 is critical and I want to have dedicated 'queue-run' commands in serveral worker servers.
In my setup I've already opted out from cron all my queues, but I do not want to run all of them under mob-exe-queue.

Decoupling the 'run under mob-exe-queue' from 'skip on cron' would allow more flexibility. Even mob_queue would be useful for just opting queues out of cron only (to completely disable them or let you decide how to run them, be it mob or queue-run).
For example, you can leave queues to run on cron, but boost queue processing throughtput by spinning a few mob-exe-queue run on peak periods.

I'm also interested on the status of the module about new features, be it if they can be accepted or the module is feature-frozen, since I want to implement this and would like to join forces, preferably.

amontero’s picture

Clarification: The mob_queue module might fit well my use case, have to test it again. Perhaps I'm mislead because of the "will only process the queue tasks selected to skip on cron" response. Perhaps only a bit of clarification in the docs/UI is needed, unless you are interested in the above mentioned decoupling feature.

For completeness, the code on Drush command:

  // Grab the defined cron queues.
  $queues = module_invoke_all('cron_queue_info');
  foreach ($queues as $name => $queue) {
    if (variable_get('mob_queue_' . $name, 0)) {
      $queues[$name]['mob_queue'] = TRUE;
    }
  }

[...]

  foreach ($queues as $queue_name => $info) {
    if (empty($info['mob_queue'])) {
      continue;
    }
    [...]

Looks like to me that not skipped on cron queues but only mob_queue marked queues will be run.

Even if hook_cron_queue_info_alter() correctly skips them:

/**
 * Implements hook_cron_info_alter().
 */
function mob_queue_cron_queue_info_alter(&$queues) {
  foreach ($queues as $name => $queue) {
    if (variable_get('mob_queue_' . $name, 0)) {
      $queues[$name]['mob_queue'] = TRUE;
      $queues[$name]['skip on cron'] = TRUE;
    }
  }
}

does not means that *all* the 'skipped on cron' queues will be run. If set to be skippen on cron *elsewhere* on Drupal it can be confusing.