Spaces:
Sleeping
Sleeping
Bound hosted Gemini request latency
Browse filesUse short connect and response deadlines so an unavailable AI provider cannot hold a hosted Streamlit session open.
- datapilot/analyst.py +2 -2
datapilot/analyst.py
CHANGED
|
@@ -220,12 +220,12 @@ DATA:\n"""
|
|
| 220 |
"X-Server-Timeout": "30",
|
| 221 |
},
|
| 222 |
json=payload,
|
| 223 |
-
timeout=(
|
| 224 |
)
|
| 225 |
logger.warning("gemini_response_received status=%d", response.status_code)
|
| 226 |
except requests.Timeout as exc:
|
| 227 |
logger.warning("gemini_request_timed_out")
|
| 228 |
-
raise ValueError("Gemini timed out after
|
| 229 |
except requests.ConnectionError as exc:
|
| 230 |
logger.warning("gemini_connection_failed")
|
| 231 |
raise ValueError("DataPilot could not connect to Gemini. Please try again.") from exc
|
|
|
|
| 220 |
"X-Server-Timeout": "30",
|
| 221 |
},
|
| 222 |
json=payload,
|
| 223 |
+
timeout=(3, 8),
|
| 224 |
)
|
| 225 |
logger.warning("gemini_response_received status=%d", response.status_code)
|
| 226 |
except requests.Timeout as exc:
|
| 227 |
logger.warning("gemini_request_timed_out")
|
| 228 |
+
raise ValueError("Gemini timed out after 8 seconds. Please try again.") from exc
|
| 229 |
except requests.ConnectionError as exc:
|
| 230 |
logger.warning("gemini_connection_failed")
|
| 231 |
raise ValueError("DataPilot could not connect to Gemini. Please try again.") from exc
|