Reduce spinning while waiting on queues

This commit is contained in:
James Cammarata 2015-11-12 14:40:56 -05:00
parent e2af57062c
commit 13750f68ee
3 changed files with 3 additions and 6 deletions

View file

@ -73,11 +73,11 @@ class ResultProcess(multiprocessing.Process):
try:
if not rslt_q.empty():
debug("worker %d has data to read" % self._cur_worker)
result = rslt_q.get()
result = rslt_q.get(block=False)
debug("got a result from worker %d: %s" % (self._cur_worker, result))
break
except queue.Empty:
pass
time.sleep(0.01)
if self._cur_worker == starting_point:
break

View file

@ -311,7 +311,7 @@ class StrategyBase:
else:
raise AnsibleError("unknown result message received: %s" % result[0])
except Queue.Empty:
pass
time.sleep(0.01)
return ret_results

View file

@ -239,9 +239,6 @@ class StrategyModule(StrategyBase):
self._blocked_hosts[host.get_name()] = True
self._queue_task(host, task, task_vars, play_context)
results = self._process_pending_results(iterator)
host_results.extend(results)
# if we're bypassing the host loop, break out now
if run_once:
break