diff --git a/backend/app/models/feed.py b/backend/app/models/feed.py index 01b9ca9..6f53a8a 100644 --- a/backend/app/models/feed.py +++ b/backend/app/models/feed.py @@ -6,7 +6,7 @@ from feedgen.feed import FeedGenerator from collections.abc import Iterator import feedparser -from aiohttp import ClientSession +from aiohttp import ClientSession, ClientTimeout import re import dateparser @@ -163,7 +163,7 @@ async def parse_feed(feed_url: HttpUrl) -> Feed: r"^(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b", feed_url.host ): raise RuntimeError("Invalid URL") - async with ClientSession(timeout=10) as aiohttp_session: + async with ClientSession(timeout=ClientTimeout(total=20)) as aiohttp_session: try: async with aiohttp_session.get( str(feed_url), diff --git a/backend/tests/e2e/test_e2e_all.py b/backend/tests/e2e/test_e2e_all.py index 3f8457d..b637ab5 100644 --- a/backend/tests/e2e/test_e2e_all.py +++ b/backend/tests/e2e/test_e2e_all.py @@ -3,7 +3,7 @@ import asyncio from os import getenv -from aiohttp import ClientSession +from aiohttp import ClientSession, ClientTimeout API_URL: str @@ -47,7 +47,7 @@ class TestGetFeeds: @pytest.mark.asyncio async def test_get_feeds_new_user(self): """Test the main use case with a new user.""" - async with ClientSession(timeout=30) as session: + async with ClientSession(timeout=ClientTimeout(total=10)) as session: # get all feeds at once results = await asyncio.gather( *[