fix race keepalived condition by popping/appending from left

This commit is contained in:
benoitc 2014-06-01 20:36:48 +02:00
parent 3cda90a214
commit abac771c44

View File

@ -120,11 +120,13 @@ class ThreadWorker(base.Worker):
now = time.time()
while True:
try:
delta = self._keep[0].timeout - now
conn = self._keep.popleft()
except IndexError:
break
delta = conn.timeout - now
if delta > 0:
self._keep.appendleft(conn)
break
else:
# remove the connection from the queue