-
Notifications
You must be signed in to change notification settings - Fork 20
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
added retry backoff for google-ads unauthorised error #83
base: main
Are you sure you want to change the base?
Conversation
tap_google_ads/streams.py
Outdated
@@ -230,13 +230,14 @@ def on_giveup_func(err): | |||
@backoff.on_exception(backoff.expo, | |||
(GoogleAdsException, | |||
ServerError, TooManyRequests, | |||
ReadTimeout, | |||
ReadTimeout, |
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 this space really needed?
AttributeError), | ||
max_tries=5, | ||
jitter=None, | ||
giveup=should_give_up, | ||
on_giveup=on_giveup_func, | ||
logger=None) | ||
@backoff.on_exception(backoff.expo, Unauthorized, max_tries=5, jitter=None,logger=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.
Can't we append Unauthorized in 1st backoff itself?
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 above exceptions have a on_giveup handler, which is not needed and does not work with this specific exception class hence added a new decorator
try: | ||
make_request(mocked_google_ads_client, "", "") | ||
except Unauthorized: | ||
pass |
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.
Use self.assertRaises instead of try-catch block
@@ -7,7 +7,7 @@ | |||
from singer import utils, metrics | |||
from google.protobuf.json_format import MessageToJson | |||
from google.ads.googleads.errors import GoogleAdsException | |||
from google.api_core.exceptions import ServerError, TooManyRequests | |||
from google.api_core.exceptions import ServerError, TooManyRequests, Unauthorized |
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.
looking at the error in CCI logs, the import has to be Unauthenticated
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.
In general, we don't retry unauthorised error, so I would like to hold this PR from merging into the master until we have a proof that fix indeed works.
Also can you add possible explanation for the occurrence of this issue?
Description of change
This adds retry for intermittent 401 auth errors
Jira: TDL-23120
QA steps
Risks
Rollback steps