feat: add LinkContentFetcher component for robust URL content retriev… - #12289
feat: add LinkContentFetcher component for robust URL content retriev…#12289iamyuviii wants to merge 1 commit into
Conversation
…al with retry logic
|
Yuvraj Khichi seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
Someone is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
|
Hi @iamyuviii, thanks a lot for your contribution! 🙏 We noticed that the Contributor License Agreement (CLA) check ( To get your PR reviewed, please sign the CLA via the link in the |
|
Hi @iamyuviii , the problem here seems to be your first commit in this branch 4d69b53 which was not linked to your GitHub account and therefore the CLA check failed. |
fix: Fix
LinkContentFetcheruser-agent rotation race conditionRelated Issues
Proposed Changes:
Bug:
The
LinkContentFetchertracked its rotating user-agent index (current_user_agent_idx) as an instance variable. When multiple URLs were fetched concurrently (e.g. viaThreadPoolExecutororasyncio.gather()), the shared state caused a race condition where concurrent requests continuously overwrote the shared index. Furthermore, afinallyblock in the fetch method forcefully reset the index back to0, which caused the vast majority of retry attempts across concurrent tasks to incorrectly stick with the unrotated, defaultagent-0.Solution:
current_user_agent_idxinstance state entirely._get_responseand_get_response_asyncto track theiruser_agent_idxinternally using local method variables. This correctly scopes the rotation logic strictly to each individual request.tenacityfor the synchronous retry logic. By implementing a manual retry loop for the sync path (which functionally mirrors the pre-existing logic in the async path), it resolves the race condition without needing complex context-passing. It additionally eliminates a discrepancy where thetenacityimplementation was previously providing one fewer retry attempt than the async implementation.How did you test it?
Tested manually via a reproduction script utilizing concurrent requests, verifying that independently-failing concurrently fetched URLs now successfully and reliably rotate to
agent-1on their retries instead of incorrectly reusingagent-0.Notes for the reviewer
None.
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes.