summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpjenvey <pjenvey@localhost>2007-08-13 21:48:55 +0000
committerpjenvey <pjenvey@localhost>2007-08-13 21:48:55 +0000
commit71080830b2799bfd8e78c77c4a6375f6b6cbbd3a (patch)
tree4909e5d7b3624b33506a9361004353942e4e4c84
parentb9c1451df30d065d6e5789fbdced366705f825c0 (diff)
downloadpaste-git-71080830b2799bfd8e78c77c4a6375f6b6cbbd3a.tar.gz
fix more possible thread errors, followup to r6843
-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: