Explorar el Código

The AMQP backend now uses the LocalCache dictionary as cache, to limit the number of results kept in memory. Closes #75

Ask Solem hace 15 años
padre
commit
1600df8024
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3 2
      celery/backends/amqp.py

+ 3 - 2
celery/backends/amqp.py

@@ -3,8 +3,9 @@ from carrot.messaging import Consumer, Publisher
 
 from celery import conf
 from celery import states
-from celery.messaging import establish_connection
 from celery.backends.base import BaseBackend
+from celery.messaging import establish_connection
+from celery.datastructures import LocalCache
 
 
 class AMQPBackend(BaseBackend):
@@ -23,7 +24,7 @@ class AMQPBackend(BaseBackend):
 
     def __init__(self, *args, **kwargs):
         super(AMQPBackend, self).__init__(*args, **kwargs)
-        self._cache = {}
+        self._cache = LocalCache(limit=1000)
 
     @property
     def connection(self):