Skip to content

fix: Synchronous HTTP client in worker#31

Open
mrwind-up-bird wants to merge 1 commit intomainfrom
autofix/dd2853cd/synchronous-http-client-in-wor
Open

fix: Synchronous HTTP client in worker#31
mrwind-up-bird wants to merge 1 commit intomainfrom
autofix/dd2853cd/synchronous-http-client-in-wor

Conversation

@mrwind-up-bird
Copy link
Copy Markdown
Collaborator

AutoFix: Synchronous HTTP client in worker

Category: performance
Severity: low

Issue

The ingestion worker uses httpx.AsyncClient but processes URLs one at a time. For sources with multiple URLs or when processing many sources concurrently, this could become a bottleneck compared to batched or parallel processing.

Fix

This fix addresses the synchronous HTTP processing bottleneck by implementing concurrent URL fetching using asyncio.gather(). The changes include: 1) Added asyncio import, 2) Modified URL extraction to support multiple URLs with backward compatibility for single URL configs, 3) Used asyncio.gather() to fetch all URLs concurrently instead of sequentially, 4) Added proper error handling for individual URL failures with logging, and 5) Combined all successful responses into a single content string. This maintains existing functionality while significantly improving performance for sources with multiple URLs.


Generated by nyxCore AutoFix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant