-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix(ai-module): add retries in the requests #73
base: main
Are you sure you want to change the base?
Conversation
attempts += 1 | ||
if attempts >= max_retries: | ||
raise RetryError(f"Failed after {max_retries} attempts: {e}") | ||
time.sleep(2) |
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.
this is not exponential backoff
try: | ||
response = await requestor.request_async(method_, url_, params) | ||
return convert_to_unique_object(response, user_id, company_id, params) | ||
except APIError as e: |
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 also make sure that only a select few errors are leading to retrys
like the one I iinked
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.
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, I actually checked this, it specifically raised
"unique_sdk._error.APIError: There was a problem proxying the request"
in the log.
although our errors are kind of general exceptions and not catching any specific one.
ref https://unique-ch.atlassian.net/browse/UN-8357