fix(common): add exponential backoff to MinIO HTTP downloads#716
Open
unidel2035 wants to merge 3 commits intoOpenSPG:masterfrom
Open
fix(common): add exponential backoff to MinIO HTTP downloads#716unidel2035 wants to merge 3 commits intoOpenSPG:masterfrom
unidel2035 wants to merge 3 commits intoOpenSPG:masterfrom
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: undefined
This fix addresses the 503 Service Unavailable errors reported in issue OpenSPG#712 when downloading files from MinIO. The download_from_http function now includes exponential backoff retry logic to handle transient service unavailability. Changes: - Added wait_exponential to the retry decorator with multiplier=1, min=2, max=10 - Updated function docstring to document retry behavior - Added comprehensive unit tests for retry mechanism The exponential backoff gives MinIO time to recover from temporary overload, significantly improving reliability when uploading files to the knowledge base. Fixes OpenSPG#712 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This reverts commit 5443472.
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 📎 Log file uploaded as GitHub Gist (226KB) Now working session is ended, feel free to review and add any feedback on the solution draft. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the 503 Service Unavailable errors when downloading files from MinIO, as reported in issue #712.
Problem
Users were experiencing
503 Server Error: Service Unavailableerrors when uploading files to the knowledge base. The error occurred during file download from MinIO storage through thedownload_from_httpfunction inkag/common/utils.py:300.The root cause was that the retry mechanism (
@retry(stop=stop_after_attempt(3))) was retrying immediately without any delay between attempts, giving MinIO no time to recover from temporary overload or unavailability.Solution
Added exponential backoff to the retry logic:
wait_exponentialfrom tenacity library@retry(stop=stop_after_attempt(3), wait=wait_exponential(multiplier=1, min=2, max=10))destparameterChanges
kag/common/utils.py: Added exponential backoff todownload_from_httpfunctiontests/unit/common/test_utils.py: Added comprehensive unit tests covering:Testing
Impact
This change significantly improves reliability when uploading files to knowledge bases by gracefully handling transient MinIO service unavailability, consistent with retry patterns used elsewhere in the codebase (e.g., LLM client, hybrid retrieval).
Fixes #712
🤖 Generated with Claude Code