-
Notifications
You must be signed in to change notification settings - Fork 26
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-16314 added request timeout #96
base: master
Are you sure you want to change the base?
Conversation
Disabled pylint for consider-using-f-string when used format. |
tap_xero/client.py
Outdated
# backoff for 1 minute when the Timeout error occurs as the request will again backoff | ||
# when timeout occurs in `refresh_credentials()`, hence instead of setting max_tries as 5 | ||
# setting the max_time of 60 seconds | ||
@backoff.on_exception(backoff.expo, Timeout, max_time=60, factor=2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we don't add ConnectTimeout here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we don't add ConnectTimeout here?
We didn't get ConnectTimeout Error here, so haven't included it
tap_xero/client.py
Outdated
@@ -12,11 +12,13 @@ | |||
import pytz | |||
import backoff | |||
import singer | |||
from requests.exceptions import Timeout, ConnectTimeout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any specific reason to import ConnectTimeout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any specific reason to import ConnectTimeout?
It was not used anywhere as ConnectTimeout inherits Timeout, hence removed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a suggestion for the test implementation.
mock_send.side_effect = Timeout | ||
mock_post.side_effect = Timeout | ||
before_time = datetime.datetime.now() | ||
with self.assertRaises(Timeout): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these with assertRaises contexts should contain only the method that raises the exception, if the XeroClient init had a request in it and that timed out unexpectedly, this would never get to the check_platform_access step. But it would still pass. While I think it is performing functionally the way it's intended, it is difficult to see exactly what is being tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
The build is failing because the token is expired on the circleci side |
…DL-16314-implement-request-timeout
Description of change
Implemented request timeout with parameter provided from config
Manual QA steps
Risks
Rollback steps