mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 15:11:23 -07:00
Reduce spinning while waiting on queues
This commit is contained in:
parent
e2af57062c
commit
13750f68ee
3 changed files with 3 additions and 6 deletions
|
@ -73,11 +73,11 @@ class ResultProcess(multiprocessing.Process):
|
||||||
try:
|
try:
|
||||||
if not rslt_q.empty():
|
if not rslt_q.empty():
|
||||||
debug("worker %d has data to read" % self._cur_worker)
|
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))
|
debug("got a result from worker %d: %s" % (self._cur_worker, result))
|
||||||
break
|
break
|
||||||
except queue.Empty:
|
except queue.Empty:
|
||||||
pass
|
time.sleep(0.01)
|
||||||
|
|
||||||
if self._cur_worker == starting_point:
|
if self._cur_worker == starting_point:
|
||||||
break
|
break
|
||||||
|
|
|
@ -311,7 +311,7 @@ class StrategyBase:
|
||||||
else:
|
else:
|
||||||
raise AnsibleError("unknown result message received: %s" % result[0])
|
raise AnsibleError("unknown result message received: %s" % result[0])
|
||||||
except Queue.Empty:
|
except Queue.Empty:
|
||||||
pass
|
time.sleep(0.01)
|
||||||
|
|
||||||
return ret_results
|
return ret_results
|
||||||
|
|
||||||
|
|
|
@ -239,9 +239,6 @@ class StrategyModule(StrategyBase):
|
||||||
self._blocked_hosts[host.get_name()] = True
|
self._blocked_hosts[host.get_name()] = True
|
||||||
self._queue_task(host, task, task_vars, play_context)
|
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 we're bypassing the host loop, break out now
|
||||||
if run_once:
|
if run_once:
|
||||||
break
|
break
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue