Index: drupal_queue.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupal_queue/drupal_queue.drush.inc,v
retrieving revision 1.5
diff -u -p -r1.5 drupal_queue.drush.inc
--- drupal_queue.drush.inc	7 Oct 2010 02:12:27 -0000	1.5
+++ drupal_queue.drush.inc	3 Jan 2011 08:10:27 -0000
@@ -13,6 +13,8 @@ function drupal_queue_drush_help($sectio
   switch ($section) {
     case 'drush:queue-cron':
       return dt('Run Drupal queue workers. As opposed to "drush cron" that can only be run one at a time on a single site, "drush queue-cron" can be invoked as many times as the server load allows. Otherwise, schedule like drush cron.');
+    case 'drush:queue-process-blocking-queue':
+      return dt('Run the named, blocking Drupal queue. Allows for processing queues that block indefinitely waiting for new jobs without holding up other queues.');
   }
 }
 
@@ -24,5 +26,13 @@ function drupal_queue_drush_command() {
     'callback' => 'drupal_queue_cron_run',
     'description' => 'Run Drupal queue workers.',
   );
+  $items['queue-process-blocking-queue'] = array(
+    'callback' => 'drupal_queue_process_blocking_queue',
+    'description' => 'Run the named, blocking Drupal queue.',
+    'arguments' => array(
+      'queue_to_process' => 'The name of the queue to run.',
+    ),
+  );
   return $items;
 }
+
Index: drupal_queue.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupal_queue/drupal_queue.module,v
retrieving revision 1.6
diff -u -p -r1.6 drupal_queue.module
--- drupal_queue.module	7 Oct 2010 02:12:28 -0000	1.6
+++ drupal_queue.module	3 Jan 2011 08:10:27 -0000
@@ -29,6 +29,45 @@ function drupal_queue_include() {
 }
 
 /**
+ * Runs the named, blocking queue.
+ *
+ * @param $queue_to_process
+ *   Arbitrary string. The name of the queue to work with.
+ */
+function drupal_queue_process_blocking_queue($queue_to_process) {
+  // Get the list of queues so we can find $queue_to_process.
+  $queues = module_invoke_all('cron_queue_info');
+  drupal_alter('cron_queue_info', $queues);
+
+  foreach ($queues as $queue_name => $info) {
+    if ($queue_name == $queue_to_process) {
+      drupal_queue_process_queue(DrupalQueue::get($queue_name), $info);
+      // Reset expired items in the default queue implementation table for this
+      // queue.
+      db_query('UPDATE {queue} SET expire = 0 WHERE expire < %d', time());
+      break;
+    }
+  }
+}
+
+/**
+ * Processes the named queue.
+ *
+ * @param $queue
+ *   An object that implements the DrupalQueueInterface
+ * @param $info
+ *   An array of configuration information for the queue.
+ */
+function drupal_queue_process_queue(DrupalQueueInterface $queue, array $info) {
+  $end = time() + (isset($info['time']) ? $info['time'] : 15);
+  $function = $info['worker callback'];
+  while (time() < $end && ($item = $queue->claimItem())) {
+    $function($item->data);
+    $queue->deleteItem($item);
+  }
+}
+
+/**
  * Alternative cron entry point.
  *
  * In comparison to drupal_cron_run(), drupal_queue_cron_run() does not use a
@@ -49,13 +88,11 @@ function drupal_queue_cron_run() {
 
   // Work off queues.
   foreach ($queues as $queue_name => $info) {
-    $function = $info['worker callback'];
-    $end = time() + (isset($info['time']) ? $info['time'] : 15);
-    $queue = DrupalQueue::get($queue_name);
-    while (time() < $end && ($item = $queue->claimItem())) {
-      $function($item->data);
-      $queue->deleteItem($item);
+    // Don't run queues that block indefinitely from cron.
+    if (isset($info['blocks indefinitely']) && $info['blocks indefinitely']) {
+      continue;
     }
+    drupal_queue_process_queue(DrupalQueue::get($queue_name), $info);
   }
 }
 
@@ -68,6 +105,7 @@ function drupal_queue_cron() {
   }
 
   // Reset expired items in the default queue implementation table. If that's
-  // not used, this will simply be a no-op (see D7 system_cron())
+  // not used, this will simply be a no-op (see D7 system_cron()).
   db_query('UPDATE {queue} SET expire = 0 WHERE expire < %d', time());
 }
+
