diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | flup/server/threadpool.py | 5 |
2 files changed, 9 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2009-10-27 Allan Saddi <allan@saddi.com> + + * Exit gracefully if a thread cannot be started when adding a new + job. + 2009-10-21 Allan Saddi <allan@saddi.com> * Add configurable timeout (default: no timeout) to be used when the diff --git a/flup/server/threadpool.py b/flup/server/threadpool.py index 98d3afe..e3d1bcd 100644 --- a/flup/server/threadpool.py +++ b/flup/server/threadpool.py @@ -89,9 +89,12 @@ class ThreadPool(object): # Maintain minimum number of spares. while self._idleCount < self._minSpare and \ self._workerCount < self._maxThreads: + try: + self._start_new_thread() + except thread.error: + return False self._workerCount += 1 self._idleCount += 1 - self._start_new_thread() # Hand off the job. if self._idleCount or allowQueuing: |