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

fix(ai-module): add retries in the requests #73

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

abiodun0
Copy link
Contributor

@abiodun0 abiodun0 commented Oct 4, 2024

attempts += 1
if attempts >= max_retries:
raise RetryError(f"Failed after {max_retries} attempts: {e}")
time.sleep(2)
Copy link
Contributor

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

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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.

@abiodun0 abiodun0 marked this pull request as ready for review October 4, 2024 17:59
@abiodun0 abiodun0 requested review from a team as code owners October 4, 2024 17:59
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.

2 participants