Commit b23dfc04 authored by Samuel GAIST's avatar Samuel GAIST

[bcpapi][broker] Go through the complete list of workers when purging

Unlike the Majordomo ZMQ example, we have "single" workers with work
assigned and possible actions taken on arrival/departure. Therefore
the purge should check the whole list to ensure that everything is
done with respect to the status of the worker.
parent c0b0f802
......@@ -269,17 +269,12 @@ class BeatComputationBroker(object):
def purge_workers(self):
"""Look for & kill expired workers.
Workers are oldest to most recent, so we stop at the first alive worker.
"""
while self.waiting:
w = self.waiting[0]
if w.expiry < time.time():
logger.info("I: deleting expired worker: %s", w.identity)
self.delete_worker(w, False)
self.waiting.pop(0)
else:
break
for item in self.waiting:
if item.expiry < time.time():
logger.info("I: deleting expired worker: %s", item.identity)
self.delete_worker(item, False)
self.waiting.pop(self.waiting.index(item))
def worker_waiting(self, worker):
"""This worker is now waiting for work."""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment