Flush the queued items in linear periodically
This commit is contained in:
parent
6b206f5d00
commit
d3418fd658
2 changed files with 9 additions and 5 deletions
|
@ -181,7 +181,7 @@ class StrategyBase:
|
|||
return False
|
||||
|
||||
passes = 1
|
||||
while not self._tqm._terminated and passes < 3:
|
||||
while not self._tqm._terminated and passes < 3 and self._pending_results > 0:
|
||||
try:
|
||||
task_result = self._final_q.get(timeout=timeout)
|
||||
original_host = get_original_host(task_result._host)
|
||||
|
|
|
@ -266,10 +266,14 @@ class StrategyModule(StrategyBase):
|
|||
if run_once:
|
||||
break
|
||||
|
||||
# FIXME: probably not required here any more with the result proc
|
||||
# having been removed, so there's no only a single result
|
||||
# queue for the main thread
|
||||
results += self._process_pending_results(iterator, one_pass=True)
|
||||
# flush the queue if we've got more items than we have workers,
|
||||
# and read back any results which may have arrived already
|
||||
if len(items_to_queue) > len(self._tqm._workers):
|
||||
self._tqm.queue_multiple_tasks(items_to_queue, play_context)
|
||||
items_to_queue = []
|
||||
|
||||
if self._pending_results > 0:
|
||||
results += self._process_pending_results(iterator, one_pass=True)
|
||||
|
||||
self._tqm.queue_multiple_tasks(items_to_queue, play_context)
|
||||
|
||||
|
|
Loading…
Reference in a new issue