Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tune default timeout and max_threads #305

Merged
merged 2 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion antsibull.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ galaxy_url = https://galaxy.ansible.com/
indexes = True
process_max = none
pypi_url = https://pypi.org/
thread_max = 80
thread_max = 15
max_retries = 10
logging_cfg = {
version = 1.0
Expand Down
6 changes: 5 additions & 1 deletion antsibull/utils/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async def __aenter__(self) -> aiohttp.ClientResponse:
for retry in range(self.max_retries):
flog.debug('Execute {0}', self.call_string)
try:
response = await self.aio_session.get(*self.args, **self.kwargs)
response = await self.aio_session.get(*self.args, **self.kwargs, timeout=20)
status_code = response.status
flog.debug('Status code {0}'.format(status_code))
if status_code < 400 or status_code in self.acceptable_error_codes:
Expand All @@ -59,6 +59,10 @@ async def __aenter__(self) -> aiohttp.ClientResponse:
return response
error_codes.append(status_code)
response.close()
except asyncio.TimeoutError:
flog.trace()
status_code = 'timeout'
error_codes.append(status_code)
except Exception as error:
flog.trace()
status_code = str(error)
Expand Down