From 59bf81cb58049705e4a83aa7ea177aae7efac4f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E9=87=91=E4=BF=AD?= Date: Mon, 10 Sep 2018 11:34:21 +0800 Subject: [PATCH] Remove unnecessary call to dict keys method --- gunicorn/arbiter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index 47ba2b66..a23501e2 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -539,7 +539,7 @@ class Arbiter(object): Maintain the number of workers by spawning or killing as required. """ - if len(self.WORKERS.keys()) < self.num_workers: + if len(self.WORKERS) < self.num_workers: self.spawn_workers() workers = self.WORKERS.items() @@ -610,7 +610,7 @@ class Arbiter(object): of the master process. """ - for _ in range(self.num_workers - len(self.WORKERS.keys())): + for _ in range(self.num_workers - len(self.WORKERS)): self.spawn_worker() time.sleep(0.1 * random.random())