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

TDL-16368 add request timeout #19

Merged
merged 11 commits into from
Dec 1, 2021

Conversation

namrata270998
Copy link
Contributor

Description of change
Added request timeout for API requests with default timeout 300 seconds

Manual QA steps

  • The request should backoff 5 times in case it is timed out.
  • Error should be thrown in case of retries not successful after 5 trials
  • Checked the request timeout works for each stream and backoff

Risks

Rollback steps

  • revert this branch

@namrata270998 namrata270998 changed the title TDL-16368 ad request timeout TDL-16368 add request timeout Nov 16, 2021
README.md Outdated Show resolved Hide resolved
Co-authored-by: Umang Agrawal <80704207+umangagrawal-crest@users.noreply.github.com>
tap_recharge/client.py Outdated Show resolved Hide resolved
Comment on lines +119 to +124
# Backoff the request for 5 times when Timeout or Connection error occurs
@backoff.on_exception(
backoff.expo,
(Timeout, requests.ConnectionError),
max_tries=5,
factor=2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@namrata270998 Can we merge the above backoff with the already available backoff on check_access_token function for consistency?

@backoff.on_exception(
backoff.expo,
Server5xxError,
max_tries=5,
factor=2)
def check_access_token(self):

Copy link
Contributor Author

@namrata270998 namrata270998 Nov 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot merge the 2 backoffs as the check_access_token() is also called from the request() function which has a backoff. Hence, to avoid more than 5 times backoff, it is placed on the top of __enter__()

@KrisPersonal KrisPersonal merged commit d195b4b into master Dec 1, 2021
@KrisPersonal KrisPersonal deleted the TDL-16368-implenet-request-timeout branch December 1, 2021 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants