Instead Queue.join(), call Thread.join() for each
thread. Otherwise the thread can be active during
process shutdown and throw weird errors.
After that, calling Queue.join() seems useless; it can
even allow additional failure situations.
Also clarify thread count logic.
nodes = Queue.Queue()
# launch workers and wait
- n = max (min (members.qsize() >> 2, 100), 1)
- for i in range(n):
+ num_nodes = len(self.queue_info.member_map)
+ num_threads = max (min (num_nodes / 4, 100), 1)
+ tlist = []
+ for i in range(num_threads):
t = threading.Thread (target = self._cmd_status_worker, args = (members, nodes))
t.daemon = True
t.start()
- members.join()
+ tlist.append(t)
+ #members.join()
+ for t in tlist:
+ t.join()
while True:
try: