From 34eb1b63f9c6b81d74ced70e283a7c5edaf5ac54 Mon Sep 17 00:00:00 2001 From: benoitc Date: Tue, 9 Sep 2014 07:23:56 +0200 Subject: [PATCH] only get last update of the worker once when checking oldest spotted by @tilgovi, a race condition is possible when making 2 consecutive calls to the last_update function, so only get it once. --- gunicorn/arbiter.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index c34fff45..d8ce4639 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -309,8 +309,9 @@ class Arbiter(object): oldest = time.time() for w in worker_values: try: - if w.tmp.last_update() < oldest: - oldest = w.tmp.last_update() + last_update = w.tmp.last_update() + if last_update < oldest: + oldest = last_update except ValueError: pass