mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 00:53:33 +00:00
fix: 修复console脏数据问题
This commit is contained in:
@@ -149,6 +149,12 @@ class ClaudeConsoleAccountService {
|
|||||||
for (const key of keys) {
|
for (const key of keys) {
|
||||||
const accountData = await client.hgetall(key)
|
const accountData = await client.hgetall(key)
|
||||||
if (accountData && Object.keys(accountData).length > 0) {
|
if (accountData && Object.keys(accountData).length > 0) {
|
||||||
|
if (!accountData.id) {
|
||||||
|
logger.warn(`⚠️ 检测到缺少ID的Claude Console账户数据,执行清理: ${key}`)
|
||||||
|
await client.del(key)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// 获取限流状态信息
|
// 获取限流状态信息
|
||||||
const rateLimitInfo = this._getRateLimitInfo(accountData)
|
const rateLimitInfo = this._getRateLimitInfo(accountData)
|
||||||
|
|
||||||
|
|||||||
@@ -774,11 +774,15 @@ class ClaudeConsoleRelayService {
|
|||||||
async _updateLastUsedTime(accountId) {
|
async _updateLastUsedTime(accountId) {
|
||||||
try {
|
try {
|
||||||
const client = require('../models/redis').getClientSafe()
|
const client = require('../models/redis').getClientSafe()
|
||||||
await client.hset(
|
const accountKey = `claude_console_account:${accountId}`
|
||||||
`claude_console_account:${accountId}`,
|
const exists = await client.exists(accountKey)
|
||||||
'lastUsedAt',
|
|
||||||
new Date().toISOString()
|
if (!exists) {
|
||||||
)
|
logger.debug(`🔎 跳过更新已删除的Claude Console账号最近使用时间: ${accountId}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
await client.hset(accountKey, 'lastUsedAt', new Date().toISOString())
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
`⚠️ Failed to update last used time for Claude Console account ${accountId}:`,
|
`⚠️ Failed to update last used time for Claude Console account ${accountId}:`,
|
||||||
|
|||||||
Reference in New Issue
Block a user