mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 09:16:17 +00:00
fix: 修复claude账号限流不会自动恢复的bug
This commit is contained in:
@@ -1190,6 +1190,8 @@ class ClaudeAccountService {
|
||||
throw new Error('Account not found')
|
||||
}
|
||||
|
||||
const accountKey = `claude:account:${accountId}`
|
||||
|
||||
// 清除限流状态
|
||||
delete accountData.rateLimitedAt
|
||||
delete accountData.rateLimitStatus
|
||||
@@ -1210,6 +1212,15 @@ class ClaudeAccountService {
|
||||
}
|
||||
await redis.setClaudeAccount(accountId, accountData)
|
||||
|
||||
// 显式删除Redis中的限流字段,避免旧标记阻止账号恢复调度
|
||||
await redis.client.hdel(
|
||||
accountKey,
|
||||
'rateLimitedAt',
|
||||
'rateLimitStatus',
|
||||
'rateLimitEndAt',
|
||||
'rateLimitAutoStopped'
|
||||
)
|
||||
|
||||
logger.success(`✅ Rate limit removed for account: ${accountData.name} (${accountId})`)
|
||||
|
||||
return { success: true }
|
||||
|
||||
@@ -715,9 +715,7 @@ class ClaudeRelayService {
|
||||
options.headers['user-agent'] = userAgent
|
||||
}
|
||||
|
||||
logger.info(
|
||||
`🔗 指纹是这个: ${options.headers['user-agent']}`
|
||||
)
|
||||
logger.info(`🔗 指纹是这个: ${options.headers['user-agent']}`)
|
||||
|
||||
// 使用自定义的 betaHeader 或默认值
|
||||
const betaHeader =
|
||||
@@ -956,9 +954,7 @@ class ClaudeRelayService {
|
||||
options.headers['user-agent'] = userAgent
|
||||
}
|
||||
|
||||
logger.info(
|
||||
`🔗 指纹是这个: ${options.headers['user-agent']}`
|
||||
)
|
||||
logger.info(`🔗 指纹是这个: ${options.headers['user-agent']}`)
|
||||
// 使用自定义的 betaHeader 或默认值
|
||||
const betaHeader =
|
||||
requestOptions?.betaHeader !== undefined ? requestOptions.betaHeader : this.betaHeader
|
||||
|
||||
Reference in New Issue
Block a user