Browse Source

CarrotListener: Should not close the consumers before the pool is terminated, just cancel the consumers.

Closes #122. Big thanks to LoTek for finding this.
Ask Solem 15 years ago
parent
commit
a9df35220e
1 changed files with 6 additions and 2 deletions
  1. 6 2
      celery/worker/listener.py

+ 6 - 2
celery/worker/listener.py

@@ -162,6 +162,9 @@ class CarrotListener(object):
         message.ack()
 
     def close_connection(self):
+        self.logger.debug("CarrotListener: "
+                          "Closing consumer channel...")
+        self.task_consumer = self.task_consumer and self.task_consumer.close()
         self.logger.debug("CarrotListener: "
                           "Closing connection to broker...")
         self.connection = self.connection and self.connection.close()
@@ -175,8 +178,9 @@ class CarrotListener(object):
             self.logger.debug("Heart: Going into cardiac arrest...")
             self.heart = self.heart.stop()
 
-        self.logger.debug("TaskConsumer: Shutting down...")
-        self.task_consumer = self.task_consumer and self.task_consumer.close()
+        self.logger.debug("TaskConsumer: Cancelling consumers...")
+        if self.task_consumer:
+            self.task_consumer.cancel()
 
         if self.event_dispatcher:
             self.logger.debug("EventDispatcher: Shutting down...")