-
Notifications
You must be signed in to change notification settings - Fork 33
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-14621: Add retry logic to requests and TDL-14622: Retry ConnectionResetErrors #60
base: master
Are you sure you want to change the base?
Conversation
|
||
@mock.patch("FuelSDK.ET_Email.get") | ||
@mock.patch("time.sleep") | ||
class TestConnectionResetError(unittest.TestCase): |
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.
Add tests for all fields. Better to have more unit tests
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.
Added test cases for all fields.
except ConnectionError: | ||
pass | ||
# verify the code backed off and requested for 5 times | ||
self.assertEquals(mocked_get.call_count, 5) |
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 5 times?
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.
For any error we are backing off for 5 times as mentioned at exacttarget_error_handling
in dao.py.
@backoff.on_exception(backoff.expo, (socket.timeout, ConnectionError), max_tries=5, factor=2)
obj.pull_subscribers_batch(['sub1']) | ||
# verify if 'singer.write_records' was called | ||
# once as there is only one record | ||
self.assertEquals(mocked_write_records.call_count, 1) |
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.
Please add comments to the code.
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.
Added comments.
Description of change
TDL-14621: Add retry logic to requests
TDL-14622: Retry ConnectionResetErrors
Manual QA steps
Risks
Rollback steps