Reap still running threads after timeout

This is an improvement to #49921 which reaps threads after the timeout
expires instead of letting them continue to take up resources.
This commit is contained in:
Toshio Kuratomi 2018-12-19 07:19:31 -08:00
parent d6fb42d1c5
commit ca90c138f4

View file

@ -50,6 +50,8 @@ def timeout(seconds=None, error_message="Timer expired"):
except multiprocessing.TimeoutError:
# This is an ansible.module_utils.common.facts.timeout.TimeoutError
raise TimeoutError('Timer expired after %s seconds' % timeout_value)
finally:
pool.terminate()
return wrapper