Skip to content

Commit

Permalink
fix: type of aiohttp client timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
m0wer committed Jul 17, 2024
1 parent 89132bb commit 062ffc7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions backend/app/models/feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions backend/tests/e2e/test_e2e_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import asyncio
from os import getenv

from aiohttp import ClientSession
from aiohttp import ClientSession, ClientTimeout

API_URL: str

Expand Down Expand Up @@ -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(
*[
Expand Down

0 comments on commit 062ffc7

Please sign in to comment.