mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 21:17:30 +00:00
fix: claude遇到5xx错误不再停止调度
This commit is contained in:
@@ -1615,7 +1615,7 @@ class ClaudeRelayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 🛠️ 统一的错误处理方法
|
// 🛠️ 统一的错误处理方法
|
||||||
async _handleServerError(accountId, statusCode, sessionHash = null, context = '') {
|
async _handleServerError(accountId, statusCode, _sessionHash = null, context = '') {
|
||||||
try {
|
try {
|
||||||
await claudeAccountService.recordServerError(accountId, statusCode)
|
await claudeAccountService.recordServerError(accountId, statusCode)
|
||||||
const errorCount = await claudeAccountService.getServerErrorCount(accountId)
|
const errorCount = await claudeAccountService.getServerErrorCount(accountId)
|
||||||
@@ -1631,10 +1631,10 @@ class ClaudeRelayService {
|
|||||||
|
|
||||||
if (errorCount > threshold) {
|
if (errorCount > threshold) {
|
||||||
const errorTypeLabel = isTimeout ? 'timeout' : '5xx'
|
const errorTypeLabel = isTimeout ? 'timeout' : '5xx'
|
||||||
|
// ⚠️ 只记录5xx/504告警,不再自动停止调度,避免上游抖动导致误停
|
||||||
logger.error(
|
logger.error(
|
||||||
`❌ ${prefix}Account ${accountId} exceeded ${errorTypeLabel} error threshold (${errorCount} errors), marking as temp_error`
|
`❌ ${prefix}Account ${accountId} exceeded ${errorTypeLabel} error threshold (${errorCount} errors), please investigate upstream stability`
|
||||||
)
|
)
|
||||||
await claudeAccountService.markAccountTempError(accountId, sessionHash)
|
|
||||||
}
|
}
|
||||||
} catch (handlingError) {
|
} catch (handlingError) {
|
||||||
logger.error(`❌ Failed to handle ${context} server error:`, handlingError)
|
logger.error(`❌ Failed to handle ${context} server error:`, handlingError)
|
||||||
|
|||||||
Reference in New Issue
Block a user