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-14621: Add retry logic to requests and TDL-14622: Retry ConnectionResetErrors #60

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

hpatel41
Copy link
Contributor

@hpatel41 hpatel41 commented Aug 6, 2021

Description of change

TDL-14621: Add retry logic to requests
TDL-14622: Retry ConnectionResetErrors

  • Added backoff for the following errors:
    • ConnectionResetError
    • socket.timeout error

Manual QA steps

Risks

Rollback steps

  • revert this branch

@hpatel41 hpatel41 marked this pull request as ready for review August 27, 2021 09:35

@mock.patch("FuelSDK.ET_Email.get")
@mock.patch("time.sleep")
class TestConnectionResetError(unittest.TestCase):

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

Copy link
Contributor Author

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why 5 times?

Copy link
Contributor Author

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)
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added comments.

@hpatel41 hpatel41 requested a review from KrisPersonal October 8, 2021 12:07
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.

4 participants