Remove unnecessary call to dict keys method

This commit is contained in:
刘金俭 2018-09-10 11:34:21 +08:00 committed by Randall Leeds
parent e179dc2575
commit 59bf81cb58

View File

@ -539,7 +539,7 @@ class Arbiter(object):
Maintain the number of workers by spawning or killing Maintain the number of workers by spawning or killing
as required. as required.
""" """
if len(self.WORKERS.keys()) < self.num_workers: if len(self.WORKERS) < self.num_workers:
self.spawn_workers() self.spawn_workers()
workers = self.WORKERS.items() workers = self.WORKERS.items()
@ -610,7 +610,7 @@ class Arbiter(object):
of the master process. 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() self.spawn_worker()
time.sleep(0.1 * random.random()) time.sleep(0.1 * random.random())