fix: 修复审查发现的3个问题
1. api-server.js: 更新过时的 performHealthChecks(true) 调用 - 方法签名改了,不再接受 isInit 参数 - 改为 performHealthChecks() 2. i18n.js: 更新描述以匹配实际行为 - '留空则检查所有供应商' -> '留空则不进行任何检查' 3. provider-pool-manager.js & provider-api.js: 移除死代码 - _checkProviderHealth 从不返回 null - 移除对 result === null 的检查
This commit is contained in:
parent
714aee54bd
commit
801917b478
4 changed files with 7 additions and 22 deletions
|
|
@ -1828,12 +1828,6 @@ export class ProviderPoolManager {
|
|||
const result = await this._checkProviderHealth(providerType, provider.config);
|
||||
const checkDuration = Date.now() - checkStartTime;
|
||||
|
||||
// result === null means check not implemented for this provider type
|
||||
if (result === null) {
|
||||
this._log('info', `[ScheduledHealthCheck] ${displayName} (${providerType}): check skipped - not implemented (${checkDuration}ms)`);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!result.success) {
|
||||
// Provider is unhealthy
|
||||
failCount++;
|
||||
|
|
|
|||
|
|
@ -355,11 +355,11 @@ async function startServer() {
|
|||
setInterval(heartbeatAndRefreshToken, CONFIG.CRON_NEAR_MINUTES * 60 * 1000);
|
||||
}
|
||||
// 服务器完全启动后,执行初始健康检查
|
||||
const poolManager = getProviderPoolManager();
|
||||
if (poolManager) {
|
||||
logger.info('[Initialization] Performing initial health checks for provider pools...');
|
||||
poolManager.performHealthChecks(true);
|
||||
}
|
||||
const poolManager = getProviderPoolManager();
|
||||
if (poolManager) {
|
||||
logger.info('[Initialization] Performing initial health checks for provider pools...');
|
||||
poolManager.performHealthChecks();
|
||||
}
|
||||
|
||||
// 定时健康检查
|
||||
const scheduledConfig = CONFIG.SCHEDULED_HEALTH_CHECK;
|
||||
|
|
|
|||
|
|
@ -709,18 +709,9 @@ export async function handleHealthCheck(req, res, currentConfig, providerPoolMan
|
|||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
try {
|
||||
const healthResult = await providerPoolManager._checkProviderHealth(providerType, providerConfig);
|
||||
|
||||
if (healthResult === null) {
|
||||
results.push({
|
||||
uuid: providerConfig.uuid,
|
||||
success: null,
|
||||
message: 'Health check not supported for this provider type'
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
if (healthResult.success) {
|
||||
providerPoolManager.markProviderHealthy(providerType, providerConfig, false, healthResult.modelName);
|
||||
results.push({
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ const translations = {
|
|||
'config.healthCheck.interval': '检查间隔',
|
||||
'config.healthCheck.intervalNote': '单位毫秒,最小60000ms(1分钟),最大3600000ms(1小时),可手动输入或点击快捷按钮',
|
||||
'config.healthCheck.providerTypes': '定时检查的供应商',
|
||||
'config.healthCheck.providerTypesNote': '选择需要进行定时健康检查的供应商类型,留空则检查所有供应商',
|
||||
'config.healthCheck.providerTypesNote': '选择需要进行定时健康检查的供应商类型,留空则不进行任何检查',
|
||||
'config.log.title': '日志设置',
|
||||
'config.log.enabled': '启用日志',
|
||||
'config.log.outputMode': '日志输出模式',
|
||||
|
|
|
|||
Loading…
Reference in a new issue