Index: beanstalkd.queue.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/beanstalkd/beanstalkd.queue.inc,v
retrieving revision 1.6.2.2
diff -u -p -r1.6.2.2 beanstalkd.queue.inc
--- beanstalkd.queue.inc	1 Jan 2010 05:55:09 -0000	1.6.2.2
+++ beanstalkd.queue.inc	3 Jan 2011 06:59:17 -0000
@@ -26,8 +26,13 @@ class BeanstalkdQueue implements DrupalQ
     if (file_exists(drupal_get_path('module', 'beanstalkd') . '/pheanstalk/classes/Pheanstalk/ClassLoader.php')) {
       module_load_include('php', 'beanstalkd', 'pheanstalk/classes/Pheanstalk/ClassLoader');
       Pheanstalk_ClassLoader::register(drupal_get_path('module', 'beanstalkd') . '/pheanstalk/classes');
-      
-      $this->beanstalkd_queue = new Pheanstalk(variable_get('beanstalkd_host', 'localhost'), variable_get('beanstalkd_port', Pheanstalk::DEFAULT_PORT));
+      $this->beanstalk_config = variable_get('beanstalk_queue_' . $name, array())
+      $this->beanstalk_config += array(
+        'host' => variable_get('beanstalkd_host', 'localhost'),
+        'port' => variable_get('beanstalkd_port', Pheanstalk::DEFAULT_PORT),
+        'timeout' => variable_get('beanstalkd_timeout', 0),
+      );
+      $this->beanstalkd_queue = new Pheanstalk($this->beanstalk_config['host'], $this->beanstalk_config['port']);  
       if ($name) {
         // If a queue name  is past then set this tube to be used and set it to be the 
         // only tube to be watched.
@@ -106,7 +111,7 @@ class BeanstalkdQueue implements DrupalQ
    *   problem.
    */
   public function claimItem($lease_time = 3600) {
-    $job = $this->beanstalkd_queue->reserve(0);
+    $job = $this->beanstalkd_queue->reserve($this->beanstalk_config['timeout']);
     if ($job) {
       $item = unserialize($job->getData());
       $item->id = $job->getId();
@@ -119,6 +124,8 @@ class BeanstalkdQueue implements DrupalQ
   /**
    * Claim the next item on any of the tubes which are being watched. Since this is a blocking
    * method it will not return until and item is claimed.
+   *
+   * This method is deprecated in favour of using setting the timeout via configuration.
    */
   public function claimItemBlocking() {
     $job = $this->beanstalkd_queue->reserve();
@@ -217,4 +224,4 @@ class BeanstalkdQueue implements DrupalQ
   private function _tubeName($name) {
     return str_replace('_', '-', $name);
   }
-}
\ No newline at end of file
+}
