-
Notifications
You must be signed in to change notification settings - Fork 187
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
feat: add exponential backoff strategy for retry #140
Conversation
Codecov Report
@@ Coverage Diff @@
## master #140 +/- ##
==========================================
+ Coverage 88.94% 89.14% +0.19%
==========================================
Files 24 25 +1
Lines 1882 1916 +34
==========================================
+ Hits 1674 1708 +34
Misses 208 208
Continue to review full report at Codecov.
|
:param int max_retry_delay: maximum delay when retrying write | ||
""" | ||
|
||
WRITES_RETRY_AFTER_STATUS_CODES = frozenset([429, 503]) |
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 we should include more codes, such as to handle the case in #144, where connection could not even be made, due to the backend service being down:
The batch item wasn't processed successfully because: HTTPSConnectionPool(host='us-central1-1.gcp.cloud2.influxdata.com', port=443): Max retries exceeded with url: /api/v2/write?org=<REDACTED>&bucket=<REDACTED>+Bucket&precision=ns (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fa44a34b6d8>: Failed to establish a new connection: [Errno 110] Connection timed out'))
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.
The all network errors are also handled. The status codes are only used for http responses with status codes.
…nds, default retry interval is 5000
Closes #144
Proposed Changes
max_retries
: the number of max retries when write failsmax_retry_delay
: the maximum delay when retrying write in millisecondsChecklist
pytest tests
completes successfully