summaryrefslogtreecommitdiff
path: root/paste/httpserver.py
diff options
context:
space:
mode:
authorpjenvey <devnull@localhost>2007-08-13 21:48:55 +0000
committerpjenvey <devnull@localhost>2007-08-13 21:48:55 +0000
commita6f337f03524970069ede4c30bff37817e79d4f2 (patch)
tree4909e5d7b3624b33506a9361004353942e4e4c84 /paste/httpserver.py
parent8f95e1273c6ac1ca254627ffb5b4cf2ae3a0bdb1 (diff)
downloadpaste-a6f337f03524970069ede4c30bff37817e79d4f2.tar.gz
fix more possible thread errors, followup to r6843
Diffstat (limited to 'paste/httpserver.py')
-rwxr-xr-xpaste/httpserver.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/paste/httpserver.py b/paste/httpserver.py
index 6309916..68a7622 100755
--- a/paste/httpserver.py
+++ b/paste/httpserver.py
@@ -617,7 +617,8 @@ class ThreadPool(object):
if not hasattr(worker, 'thread_id'):
# Not initialized
continue
- time_started, info = self.worker_tracker.get(worker.thread_id, (None, None))
+ time_started, info = self.worker_tracker.get(worker.thread_id,
+ (None, None))
if time_started is not None:
if now - time_started < self.hung_thread_limit:
busy += 1
@@ -658,8 +659,9 @@ class ThreadPool(object):
# The worker hasn't fully started up, we should just
# ignore it
continue
- if worker.thread_id in self.worker_tracker:
- time_started, info = self.worker_tracker[worker.thread_id]
+ time_started, info = self.worker_tracker.get(worker.thread_id,
+ (None, None))
+ if time_started is not None:
if now - time_started > self.hung_thread_limit:
result['hung'].append(worker)
else:
@@ -737,12 +739,13 @@ class ThreadPool(object):
# Not setup yet
starting_workers += 1
continue
- if worker.thread_id not in self.worker_tracker:
+ time_started, info = self.worker_tracker.get(worker.thread_id,
+ (None, None))
+ if time_started is None:
# Must be idle
idle_workers += 1
continue
working_workers += 1
- time_started, info = self.worker_tracker[worker.thread_id]
max_time = max(max_time, now-time_started)
total_time += now-time_started
if now - time_started > self.kill_thread_limit: