feat: 大规模性能优化 - Redis Pipeline 批量操作、索引系统、连接池优化

This commit is contained in:
SunSeekerX
2025-12-31 02:08:47 +08:00
parent a345812cd7
commit 584fa8c9c1
68 changed files with 6541 additions and 4536 deletions

View File

@@ -288,10 +288,12 @@ router.get('/sync/export-accounts', authenticateAdmin, async (req, res) => {
// ===== OpenAI OAuth accounts =====
const openaiOAuthAccounts = []
{
const client = redis.getClientSafe()
const openaiKeys = await client.keys('openai:account:*')
for (const key of openaiKeys) {
const id = key.split(':').slice(2).join(':')
const openaiIds = await redis.getAllIdsByIndex(
'openai:account:index',
'openai:account:*',
/^openai:account:(.+)$/
)
for (const id of openaiIds) {
const account = await openaiAccountService.getAccount(id)
if (!account) {
continue
@@ -390,10 +392,12 @@ router.get('/sync/export-accounts', authenticateAdmin, async (req, res) => {
// ===== OpenAI Responses API Key accounts =====
const openaiResponsesAccounts = []
const client = redis.getClientSafe()
const openaiResponseKeys = await client.keys('openai_responses_account:*')
for (const key of openaiResponseKeys) {
const id = key.split(':').slice(1).join(':')
const openaiResponseIds = await redis.getAllIdsByIndex(
'openai_responses_account:index',
'openai_responses_account:*',
/^openai_responses_account:(.+)$/
)
for (const id of openaiResponseIds) {
const full = await openaiResponsesAccountService.getAccount(id)
if (!full) {
continue