Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -28,7 +28,8 @@ REQUEST_DELAY = 9.0 # 2 seconds delay to meet 30 RPM
|
|
28 |
async def fetch_questions(session: aiohttp.ClientSession, questions_url: str) -> list:
|
29 |
"""Fetch questions asynchronously."""
|
30 |
try:
|
31 |
-
async with session.get(questions_url,
|
|
|
32 |
response.raise_for_status()
|
33 |
questions_data = await response.json()
|
34 |
if not questions_data:
|
@@ -72,7 +73,7 @@ async def process_question(agent, question_text: str, task_id: str, semaphore: a
|
|
72 |
return None
|
73 |
finally:
|
74 |
if "Malko" in question or "Mercedes Sosa" in question or "Teal" in question or "chess" in question or "Marisa" in question or "Yankee" in question:
|
75 |
-
await asyncio.sleep(12) # Enforce delay after each request
|
76 |
else:
|
77 |
await asyncio.sleep(REQUEST_DELAY) # Enforce delay after each request
|
78 |
|
|
|
28 |
async def fetch_questions(session: aiohttp.ClientSession, questions_url: str) -> list:
|
29 |
"""Fetch questions asynchronously."""
|
30 |
try:
|
31 |
+
async with session.get(questions_url,
|
32 |
+
timeout=15) as response:
|
33 |
response.raise_for_status()
|
34 |
questions_data = await response.json()
|
35 |
if not questions_data:
|
|
|
73 |
return None
|
74 |
finally:
|
75 |
if "Malko" in question or "Mercedes Sosa" in question or "Teal" in question or "chess" in question or "Marisa" in question or "Yankee" in question:
|
76 |
+
await asyncio.sleep(12.0) # Enforce delay after each request
|
77 |
else:
|
78 |
await asyncio.sleep(REQUEST_DELAY) # Enforce delay after each request
|
79 |
|