-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
🐛 Slack source connector: do not give up retry attempts if there is 429 error #5708
Conversation
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.
lgtm.
#5697 may be related.
follow the rules and evaluate delay given by "Retry-After" header. | ||
Do not give up retry attempts in case of 429 error. | ||
""" | ||
return True |
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.
As I understand that when we receive 429 errors, we will always make a sleep for code and one more try for current request. Perhaps it is worth adding, if not the number of retries for one request, then the maximum time, so that an infinite time loop does not turn out? WDYT?
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.
Make sense, updated PR
# own retry counter based on response type. | ||
return None | ||
|
||
def should_retry(self, response: requests.Response) -> bool: |
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'm a little worried about introducing infinite retry here. can we just raise number of retries to 20 or something?
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.
Yeah, you right, added time limit on 429 retry attempts
return True | ||
self.retry_attempts += 1 | ||
# In case response is not 429 follow standrad retry logic but implement own retry counter. | ||
return self.retry_attempts <= self.max_retry_attempts and super().should_retry(response) |
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.
does this ever reset? I think this currently monotonically increases this counter which is not the desired behavior
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.
Yes, it being reset in should_retry function. This is tested on test_slack_stream_backoff_500 test case.
request_started_at = None | ||
|
||
@property | ||
def max_retries(self) -> Union[int, None]: |
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.
Resetting some side variables based on accessing a property is very hacky/non-obvious and could result in incorrect behavior.
Is there any reason not to just increase retries a lot? e.g: max_retries = 20
and call it a day? is there a need for all the extra logic?
We could implement the thing you are trying to do here correctly by first implementing https://github.com/airbytehq/airbyte/issues/2762, but the current approach is using the retry methods incorrectly
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.
@sherifnada Done, just increased max retry attempts
4eba61a
to
d63b630
Compare
d63b630
to
ee5d991
Compare
What
Part of fix for #5683
How
Describe the solution
Recommended reading order
x.java
y.python
Pre-merge Checklist
Expand the relevant checklist and delete the others.
New Connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
docs/SUMMARY.md
docs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampledocs/integrations/README.md
airbyte-integrations/builds.md
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing./publish
command described hereUpdating a connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
docs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing./publish
command described hereConnector Generator
-scaffold
in their name) have been updated with the latest scaffold by running./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates
then checking in your changes