Browse Source

Fixed fast growing memory leak introduced in master branch (not present in 2.1.x or previous versions).

We use a modified task publisher that only declares exchanges it has not
already declared previously in the same process.  To keep track of this
we use a global set.  With kombu `Publisher.exchange` is a
`kombu.entity.Exchange` instance instead, so it would always add the
exchange to this set.

Thanks to PiotrSikora! Closes #271.
Ask Solem 14 years ago
parent
commit
ad62b18917
1 changed files with 2 additions and 2 deletions
  1. 2 2
      celery/app/amqp.py

+ 2 - 2
celery/app/amqp.py

@@ -95,9 +95,9 @@ class TaskPublisher(messaging.Publisher):
     auto_declare = False
 
     def declare(self):
-        if self.exchange not in _exchanges_declared:
+        if self.exchange.name not in _exchanges_declared:
             super(TaskPublisher, self).declare()
-            _exchanges_declared.add(self.exchange)
+            _exchanges_declared.add(self.exchange.name)
 
     def delay_task(self, task_name, task_args=None, task_kwargs=None,
             countdown=None, eta=None, task_id=None, taskset_id=None,