Skip to content

fix: preserve timeout across HTTP retries in requests_utils#11388

Closed
rautaditya2606 wants to merge 6 commits into
deepset-ai:mainfrom
rautaditya2606:main
Closed

fix: preserve timeout across HTTP retries in requests_utils#11388
rautaditya2606 wants to merge 6 commits into
deepset-ai:mainfrom
rautaditya2606:main

Conversation

@rautaditya2606
Copy link
Copy Markdown
Contributor

Proposed Changes:

request_with_retry and async_request_with_retry use tenacity to retry the inner run() function. That function previously called kwargs.pop("timeout", 10), which mutates the shared kwargs dict. On the first attempt the caller’s timeout was used; on later retries timeout was already removed, so retries fell back to the default 10 seconds.

The fix copies kwargs at the start of each attempt (request_kwargs = dict(kwargs)) and pops timeout from 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 passed
  • hatch 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 under releasenotes/notes/. No API or docstring changes.

Checklist

  • I have read the contributors guidelines and the code of conduct.
  • I have updated the related issue with new insights and changes. (N/A if no linked issue)
  • I have added unit tests and updated the docstrings. (Existing unit tests cover this module; no docstring changes needed.)
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I have documented my code.
  • I have added a release note file, following the contributors guidelines.
  • I have run pre-commit hooks and fixed any issue.

Copilot AI review requested due to automatic review settings May 24, 2026 10:32
@rautaditya2606 rautaditya2606 requested a review from a team as a code owner May 24, 2026 10:32
@rautaditya2606 rautaditya2606 requested review from davidsbatista and removed request for a team May 24, 2026 10:32
@vercel
Copy link
Copy Markdown

vercel Bot commented May 24, 2026

@rautaditya2606 is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@sjrl
Copy link
Copy Markdown
Contributor

sjrl commented May 26, 2026

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.

@sjrl sjrl closed this May 26, 2026
@julian-risch julian-risch requested review from julian-risch and removed request for davidsbatista and julian-risch May 26, 2026 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants