1. cherrypy
  2. CherryPy


Jason R. Coombs  committed e50561f

Updated _all_ready to be a more generic _all method, more similar to the all keyword in Python 2.5+.

  • Participants
  • Parent commits be37253
  • Branches cherrypy-3.2.x

Comments (0)

Files changed (1)

File cherrypy/wsgiserver/wsgiserver2.py

View file
  • Ignore whitespace
         n_new = min(amount, budget)
         workers = [self._spawn_worker() for i in range(n_new)]
-        while not self._all_ready(workers):
+        while not self._all(operator.attrgetter('ready'), workers):
         return worker
-    def _all_ready(workers):
-        ready_states = [worker.ready for worker in workers]
-        return reduce(operator.and_, ready_states, True)
-    _all_ready = staticmethod(_all_ready)
+    def _all(func, items):
+        results = [func(item) for item in items]
+        return reduce(operator.and_, results, True)
+    _all = staticmethod(_all)
     def shrink(self, amount):
         """Kill off worker threads (not below self.min)."""