Browse Source

Adds grow/shrink methods to eventlet TaskPool

Mher Movsisyan 10 years ago
parent
commit
1c6065383e
1 changed files with 10 additions and 0 deletions
  1. 10 0
      celery/concurrency/eventlet.py

+ 10 - 0
celery/concurrency/eventlet.py

@@ -131,6 +131,16 @@ class TaskPool(base.BasePool):
                         callback, accept_callback,
                         self.getpid)
 
+    def grow(self, n=1):
+        limit = self.limit + n
+        self._pool.resize(limit)
+        self.limit = limit
+
+    def shrink(self, n=1):
+        limit = self.limit - n
+        self._pool.resize(limit)
+        self.limit = limit
+
     def _get_info(self):
         return {
             'max-concurrency': self.limit,