From 157b9cfa9ff12124fe2ee9d6d8923c7f7d9cb4b9 Mon Sep 17 00:00:00 2001 From: cmyui Date: Sat, 13 Jul 2024 19:54:05 -0400 Subject: [PATCH 1/2] Remove timeout overrides for mirrors --- app/adapters/osu_mirrors/backends/__init__.py | 2 +- app/adapters/osu_mirrors/backends/mino.py | 2 -- app/adapters/osu_mirrors/backends/osu_direct.py | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/app/adapters/osu_mirrors/backends/__init__.py b/app/adapters/osu_mirrors/backends/__init__.py index 091b268..c073cc6 100644 --- a/app/adapters/osu_mirrors/backends/__init__.py +++ b/app/adapters/osu_mirrors/backends/__init__.py @@ -27,7 +27,7 @@ class AbstractBeatmapMirror(ABC): supported_resources: ClassVar[set[MirrorResource]] def __init__(self, *args: Any, **kwargs: Any) -> None: - self.http_client = httpx.AsyncClient() + self.http_client = httpx.AsyncClient(timeout=httpx.Timeout()) self.weight = 0 super().__init__(*args, **kwargs) diff --git a/app/adapters/osu_mirrors/backends/mino.py b/app/adapters/osu_mirrors/backends/mino.py index cac9677..807687a 100644 --- a/app/adapters/osu_mirrors/backends/mino.py +++ b/app/adapters/osu_mirrors/backends/mino.py @@ -24,7 +24,6 @@ async def fetch_beatmap_zip_data( response = await self.http_client.get( f"{self.base_url}/d/{beatmapset_id}", headers={"x-ratelimit-key": settings.MINO_INCREASED_RATELIMIT_KEY}, - timeout=httpx.Timeout(None, connect=2), ) if response.status_code in (404, 451): return BeatmapMirrorResponse( @@ -59,7 +58,6 @@ async def fetch_beatmap_background_image( logging.info(f"Fetching beatmap background from mino: {beatmap_id}") response = await self.http_client.get( f"{self.base_url}/preview/background/{beatmap_id}", - timeout=httpx.Timeout(None, connect=2), ) if response.status_code in (404, 451): return BeatmapMirrorResponse( diff --git a/app/adapters/osu_mirrors/backends/osu_direct.py b/app/adapters/osu_mirrors/backends/osu_direct.py index 26ac76e..6655295 100644 --- a/app/adapters/osu_mirrors/backends/osu_direct.py +++ b/app/adapters/osu_mirrors/backends/osu_direct.py @@ -22,7 +22,6 @@ async def fetch_beatmap_zip_data( try: response = await self.http_client.get( f"{self.base_url}/api/d/{beatmapset_id}", - timeout=httpx.Timeout(None, connect=2), ) if response.status_code in (404, 451): return BeatmapMirrorResponse( @@ -56,7 +55,6 @@ async def fetch_beatmap_background_image( try: response = await self.http_client.get( f"{self.base_url}/api/media/background/{beatmap_id}", - timeout=httpx.Timeout(None, connect=2), ) if response.status_code in (404, 451): return BeatmapMirrorResponse( From ff53d8b4f53dc071e5dd7b3520d98ff4a0c30a1c Mon Sep 17 00:00:00 2001 From: Josh Smith Date: Sat, 13 Jul 2024 19:54:36 -0400 Subject: [PATCH 2/2] undo change --- app/adapters/osu_mirrors/backends/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/adapters/osu_mirrors/backends/__init__.py b/app/adapters/osu_mirrors/backends/__init__.py index c073cc6..091b268 100644 --- a/app/adapters/osu_mirrors/backends/__init__.py +++ b/app/adapters/osu_mirrors/backends/__init__.py @@ -27,7 +27,7 @@ class AbstractBeatmapMirror(ABC): supported_resources: ClassVar[set[MirrorResource]] def __init__(self, *args: Any, **kwargs: Any) -> None: - self.http_client = httpx.AsyncClient(timeout=httpx.Timeout()) + self.http_client = httpx.AsyncClient() self.weight = 0 super().__init__(*args, **kwargs)