reduce concurrency when fetching images + add retries
This commit is contained in:
parent
59c33428c2
commit
20ff91d663
3 changed files with 8 additions and 7 deletions
|
|
@ -6,7 +6,7 @@ from typing import Any
|
|||
import aiohttp
|
||||
from models.listing import FurnishType, ListingType, QueryParameters
|
||||
from rec import districts
|
||||
from tenacity import retry, wait_random
|
||||
from tenacity import retry, stop_after_attempt, wait_random
|
||||
|
||||
|
||||
headers = {
|
||||
|
|
@ -27,7 +27,7 @@ class PropertyType(enum.StrEnum):
|
|||
TERRACED = "terraced"
|
||||
|
||||
|
||||
@retry(wait=wait_random(min=1, max=2))
|
||||
@retry(wait=wait_random(min=1, max=2), stop=stop_after_attempt(3))
|
||||
async def detail_query(detail_id: int) -> dict[str, Any]:
|
||||
params = {
|
||||
"apiApplication": "ANDROID",
|
||||
|
|
@ -44,6 +44,7 @@ async def detail_query(detail_id: int) -> dict[str, Any]:
|
|||
return await response.json()
|
||||
|
||||
|
||||
@retry(wait=wait_random(min=1, max=2), stop=stop_after_attempt(3))
|
||||
async def listing_query(
|
||||
*,
|
||||
page: int,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue