feat: 优化超时配置

This commit is contained in:
tbphp
2025-06-13 12:36:13 +08:00
parent 3232d34534
commit d82d46376f
8 changed files with 137 additions and 80 deletions

View File

@@ -32,9 +32,6 @@ MAX_RETRIES=3
# 上游 API 地址
OPENAI_BASE_URL=https://api.openai.com
# 请求超时时间(毫秒)
REQUEST_TIMEOUT=30000
# ===========================================
# 性能优化配置
# ===========================================
@@ -76,3 +73,30 @@ ENABLE_CORS=true
# 允许的来源(逗号分隔,* 表示允许所有)
ALLOWED_ORIGINS=*
ALLOWED_METHODS=GET,POST,PUT,DELETE,OPTIONS
ALLOWED_HEADERS=*
ALLOW_CREDENTIALS=false
# ===========================================
# 超时配置
# ===========================================
# 服务器读取超时时间(秒)
SERVER_READ_TIMEOUT=120
# 服务器写入超时时间(秒)
SERVER_WRITE_TIMEOUT=1800
# 服务器空闲超时时间(秒)
SERVER_IDLE_TIMEOUT=120
# 服务器优雅关闭超时时间(秒)
SERVER_GRACEFUL_SHUTDOWN_TIMEOUT=60
# 请求超时时间(秒)
REQUEST_TIMEOUT=30
# 响应超时时间(秒)- 控制TLS握手和响应头接收超时
RESPONSE_TIMEOUT=30
# 空闲连接超时时间(秒)- 控制连接池中空闲连接的生存时间
IDLE_CONN_TIMEOUT=120