Skip to content

fix: Handle TimeoutError in fetch_info to prevent double wait#600

Merged
arabcoders merged 5 commits into
masterfrom
dev
May 7, 2026
Merged

fix: Handle TimeoutError in fetch_info to prevent double wait#600
arabcoders merged 5 commits into
masterfrom
dev

Conversation

@arabcoders

@arabcoders arabcoders commented May 7, 2026

Copy link
Copy Markdown
Owner

This pull request introduces two main improvements: (1) URL validation is now performed asynchronously in a thread to avoid blocking the event loop, and (2) extraction timeouts are dynamically increased ("budgeted") for requests that are expected to involve significant sleep intervals, improving reliability for sleep-heavy sources. The changes also include new tests to ensure these behaviors are correct.

Asynchronous URL Validation:

  • All usages of validate_url in request handlers are now run using asyncio.to_thread, ensuring that potentially blocking validation does not block the main event loop.

Timeout Budgeting for Sleep-Heavy Extraction:

  • A new budget_sleep parameter is added to fetch_info and all its intended call sites. When enabled, the extraction timeout is increased based on the configured sleep interval, up to a maximum of 300 seconds extra. This helps prevent premature timeouts for sources that require many sleep intervals.

Other Improvements:

  • In app/routes/api/images.py, the thumbnail fetcher now explicitly sets a 10-second timeout for HTTP requests.

@arabcoders arabcoders changed the title fix: show add button on same row fix: Handle TimeoutError in fetch_info to prevent double wait May 7, 2026
@arabcoders arabcoders merged commit 522e6a7 into master May 7, 2026
14 checks passed
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