mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-30 20:20:21 -07:00
Performance improvements
* Speed up serialization of hostvars by simply using the internal dictionary used for cached lookups * Use blocking gets/puts on queues instead of spin locking * Merge sequential implicitly created blocks
This commit is contained in:
parent
1d402ae390
commit
e7b2308b66
5 changed files with 57 additions and 42 deletions
|
@ -72,9 +72,9 @@ class ResultProcess(multiprocessing.Process):
|
|||
self._cur_worker = 0
|
||||
|
||||
try:
|
||||
if not rslt_q.empty():
|
||||
if rslt_q.qsize() > 0:
|
||||
debug("worker %d has data to read" % self._cur_worker)
|
||||
result = rslt_q.get(block=False)
|
||||
result = rslt_q.get()
|
||||
debug("got a result from worker %d: %s" % (self._cur_worker, result))
|
||||
break
|
||||
except queue.Empty:
|
||||
|
@ -102,7 +102,7 @@ class ResultProcess(multiprocessing.Process):
|
|||
try:
|
||||
result = self._read_worker_result()
|
||||
if result is None:
|
||||
time.sleep(0.1)
|
||||
time.sleep(0.01)
|
||||
continue
|
||||
|
||||
# if this task is registering a result, do it now
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue