Browse Source

Bugfix was not properly backported to 3.0. Closes #1297

Ask Solem 12 years ago
parent
commit
4a702db6b2
1 changed files with 3 additions and 1 deletions
  1. 3 1
      celery/worker/__init__.py

+ 3 - 1
celery/worker/__init__.py

@@ -153,6 +153,8 @@ class Pool(bootsteps.StartStopComponent):
         forking_enable = w.no_execv or not w.force_execv
         if not threaded:
             semaphore = w.semaphore = BoundedSemaphore(procs)
+            w._quick_acquire = w.semaphore.acquire
+            w._quick_release = w.semaphore.release
             max_restarts = 100
         allow_restart = self.autoreload_enabled or w.pool_restarts
         pool = w.pool = self.instantiate(
@@ -374,7 +376,7 @@ class WorkController(configurated):
         self._shutdown_complete.wait()
 
     def process_task_sem(self, req):
-        return self.semaphore.acquire(self.process_task, req)
+        return self._quick_acquire(self.process_task, req)
 
     def process_task(self, req):
         """Process task by sending it to the pool of workers."""