fix: preserve timeout across HTTP retries in requests_utils#11388
Closed
rautaditya2606 wants to merge 6 commits into
Closed
fix: preserve timeout across HTTP retries in requests_utils#11388rautaditya2606 wants to merge 6 commits into
rautaditya2606 wants to merge 6 commits into
Conversation
|
@rautaditya2606 is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
…mersZeroShotDocumentClassifier
Contributor
|
Hey @rautaditya2606 I'm closing this as a duplicate of #11386 Also please in the future check your PR to make sure only changes related to the issue are pushed. You have multiple other changes related to other issues in this PR. |
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.
Proposed Changes:
request_with_retryandasync_request_with_retryuse tenacity to retry the innerrun()function. That function previously calledkwargs.pop("timeout", 10), which mutates the sharedkwargsdict. On the first attempt the caller’s timeout was used; on later retriestimeoutwas already removed, so retries fell back to the default 10 seconds.The fix copies
kwargsat the start of each attempt (request_kwargs = dict(kwargs)) and popstimeoutfrom that copy only, so every retry uses the same timeout the caller specified.How did you test it?
hatch run test:unit test/utils/test_requests_utils.py -k request_with_retry— all 16 tests passedhatch run fmt— passed(Scoped to
test/utils/to avoid unrelated e2e collection errors in the default test env.)Notes for the reviewer
Small, behavior-only change in
haystack/utils/requests_utils.py(sync + async). Release note added underreleasenotes/notes/. No API or docstring changes.Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes.