Fix performance issue with large task retries. (#51581)

This commit is contained in:
Matt Clay 2019-01-31 15:44:57 -08:00 committed by ansibot
parent 769c237dc7
commit f6e129046a

View file

@ -18,6 +18,7 @@ from ansible import constants as C
from ansible.errors import AnsibleError, AnsibleParserError, AnsibleUndefinedVariable, AnsibleConnectionFailure, AnsibleActionFail, AnsibleActionSkip from ansible.errors import AnsibleError, AnsibleParserError, AnsibleUndefinedVariable, AnsibleConnectionFailure, AnsibleActionFail, AnsibleActionSkip
from ansible.executor.task_result import TaskResult from ansible.executor.task_result import TaskResult
from ansible.module_utils.six import iteritems, string_types, binary_type from ansible.module_utils.six import iteritems, string_types, binary_type
from ansible.module_utils.six.moves import xrange
from ansible.module_utils._text import to_text, to_native from ansible.module_utils._text import to_text, to_native
from ansible.module_utils.connection import write_to_file_descriptor from ansible.module_utils.connection import write_to_file_descriptor
from ansible.playbook.conditional import Conditional from ansible.playbook.conditional import Conditional
@ -638,7 +639,7 @@ class TaskExecutor:
display.debug("starting attempt loop") display.debug("starting attempt loop")
result = None result = None
for attempt in range(1, retries + 1): for attempt in xrange(1, retries + 1):
display.debug("running the handler") display.debug("running the handler")
try: try:
result = self._handler.run(task_vars=variables) result = self._handler.run(task_vars=variables)