mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 18:54:51 +00:00
feat: 优化并发控制和移除冗余限制功能
主要改进: 1. 改进并发控制机制 - 使用 once 代替 on 避免重复监听 - 监听多个事件确保可靠性(close、finish) - 支持客户端断开时立即释放并发槽位 2. 支持非流式请求的客户端断开处理 - 客户端断开时立即中断上游请求 - 避免资源浪费和不必要的 API 调用 3. 移除 requestLimit(请求数限制)功能 - 移除配置和验证逻辑 - 保留请求统计用于监控分析 4. 移除速率限制(Rate Limit)功能 - 移除 RATE_LIMIT_* 配置 - 简化中间件逻辑 - 避免与并发控制重复 现在系统仅保留: - Token 使用量限制 - 并发数限制(更精确的资源控制) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -30,7 +30,6 @@ router.post('/api-keys', authenticateAdmin, async (req, res) => {
|
||||
name,
|
||||
description,
|
||||
tokenLimit,
|
||||
requestLimit,
|
||||
expiresAt,
|
||||
claudeAccountId,
|
||||
concurrencyLimit
|
||||
@@ -53,9 +52,6 @@ router.post('/api-keys', authenticateAdmin, async (req, res) => {
|
||||
return res.status(400).json({ error: 'Token limit must be a non-negative integer' });
|
||||
}
|
||||
|
||||
if (requestLimit && (!Number.isInteger(Number(requestLimit)) || Number(requestLimit) < 0)) {
|
||||
return res.status(400).json({ error: 'Request limit must be a non-negative integer' });
|
||||
}
|
||||
|
||||
if (concurrencyLimit !== undefined && concurrencyLimit !== null && concurrencyLimit !== '' && (!Number.isInteger(Number(concurrencyLimit)) || Number(concurrencyLimit) < 0)) {
|
||||
return res.status(400).json({ error: 'Concurrency limit must be a non-negative integer' });
|
||||
@@ -65,7 +61,6 @@ router.post('/api-keys', authenticateAdmin, async (req, res) => {
|
||||
name,
|
||||
description,
|
||||
tokenLimit,
|
||||
requestLimit,
|
||||
expiresAt,
|
||||
claudeAccountId,
|
||||
concurrencyLimit
|
||||
|
||||
Reference in New Issue
Block a user