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

LITE-28626 reduce default connect timeout and retry also on exception… #74

Merged
merged 1 commit into from
Sep 18, 2023
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 connect/client/fluent.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(
default_limit=100,
max_retries=3,
logger=None,
timeout=(180.0, 180.0),
timeout=(15.0, 180.0),
resourceset_append=True,
):
if default_headers and 'Authorization' in default_headers:
Expand Down
17 changes: 12 additions & 5 deletions connect/client/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _execute_http_call(self, method, url, kwargs): # noqa: CCR001
self.response = self._session.request(method, url, **kwargs)
if self.logger:
self.logger.log_response(self.response)
except Timeout:
except RequestException:
if retry_count < self.max_retries:
retry_count += 1
time.sleep(1)
Expand Down Expand Up @@ -208,18 +208,25 @@ async def _execute_http_call(self, method, url, kwargs):
if self.logger:
self.logger.log_request(method, url, kwargs)

self.response = await self._session.request(method, url, **kwargs)

if self.logger:
self.logger.log_response(self.response)
try:
self.response = await self._session.request(method, url, **kwargs)

if self.logger:
self.logger.log_response(self.response)
except HTTPError:
if retry_count < self.max_retries:
retry_count += 1
time.sleep(1)
continue
raise
if ( # pragma: no branch
self.response.status_code >= 500 and retry_count < self.max_retries
):
retry_count += 1
time.sleep(1)
continue
break # pragma: no cover

if self.response.status_code >= 400:
self.response.raise_for_status()

Expand Down
Loading