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.
This commit is contained in:
benoitc 2014-09-09 07:23:56 +02:00
parent 4fe426cd66
commit 34eb1b63f9

View File

@ -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