Modify the stream read response timeout to 5 seconds.
Browse files
main.py
CHANGED
@@ -21,7 +21,7 @@ from urllib.parse import urlparse
|
|
21 |
@asynccontextmanager
|
22 |
async def lifespan(app: FastAPI):
|
23 |
# 启动时的代码
|
24 |
-
timeout = httpx.Timeout(connect=15.0, read=
|
25 |
app.state.client = httpx.AsyncClient(timeout=timeout)
|
26 |
yield
|
27 |
# 关闭时的代码
|
|
|
21 |
@asynccontextmanager
|
22 |
async def lifespan(app: FastAPI):
|
23 |
# 启动时的代码
|
24 |
+
timeout = httpx.Timeout(connect=15.0, read=5.0, write=30.0, pool=30.0)
|
25 |
app.state.client = httpx.AsyncClient(timeout=timeout)
|
26 |
yield
|
27 |
# 关闭时的代码
|