-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[ENH]: Client side retries #5419
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
base: 09-02-_enh_consolidate_retries
Are you sure you want to change the base?
[ENH]: Client side retries #5419
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
Add Client-Side Retries to Python FastAPI Client This PR introduces client-side automatic retry logic for the Python FastAPI client in Chroma. Requests that encounter retryable network and server-side errors (such as transient connection failures or HTTP 502/503/504 errors from the FE) will now be retried with an exponential backoff strategy up to three times. The retry mechanism uses the Key Changes• Introduce Affected Areas• chromadb/api/fastapi.py (Python client for This summary was automatically generated by @propel-code-bot |
max=60 | ||
), | ||
retry=retry_if_exception_type(is_retryable_exception), | ||
before_sleep=before_sleep_log(logger, logging.INFO), |
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.
[CriticalError]
The retry condition uses retry_if_exception_type(is_retryable_exception)
but is_retryable_exception
returns a boolean, not an exception type. This should use retry_if_exception(is_retryable_exception)
instead. The current code will cause tenacity to fail when trying to match exception types.
before_sleep=before_sleep_log(logger, logging.INFO), | |
retry=retry_if_exception(is_retryable_exception), |
⚡ Committable suggestion
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
Context for Agents
[**CriticalError**]
The retry condition uses `retry_if_exception_type(is_retryable_exception)` but `is_retryable_exception` returns a boolean, not an exception type. This should use `retry_if_exception(is_retryable_exception)` instead. The current code will cause tenacity to fail when trying to match exception types.
```suggestion
retry=retry_if_exception(is_retryable_exception),
```
⚡ **Committable suggestion**
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
File: chromadb/api/fastapi.py
Line: 135
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.
lets add the same retry logic for js as well
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.
agree we should do this for JS as well
retry=retry_if_exception_type(is_retryable_exception), | ||
before_sleep=before_sleep_log(logger, logging.INFO), | ||
reraise=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.
probably ok for now but maybe good to make this configurable in the future?
Description of changes
Test plan
tested in tilt
pytest
for python,yarn test
for js,cargo test
for rustMigration plan
None. Need to send out a notice to upgrade clients
Observability plan
In tilt and staging
Documentation Changes
None