This commit is contained in:
SunSeekerX
2026-01-04 12:05:53 +08:00
parent 90023d1551
commit f5e982632d
28 changed files with 481 additions and 213 deletions

View File

@@ -41,7 +41,9 @@ async function migrate() {
stats.dailyIndex++
}
}
if (keys.length > 0) await pipeline.exec()
if (keys.length > 0) {
await pipeline.exec()
}
} while (cursor !== '0')
console.log(` 已处理 ${stats.dailyIndex}`)
@@ -63,7 +65,9 @@ async function migrate() {
stats.hourlyIndex++
}
}
if (keys.length > 0) await pipeline.exec()
if (keys.length > 0) {
await pipeline.exec()
}
} while (cursor !== '0')
console.log(` 已处理 ${stats.hourlyIndex}`)
@@ -85,7 +89,9 @@ async function migrate() {
stats.modelDailyIndex++
}
}
if (keys.length > 0) await pipeline.exec()
if (keys.length > 0) {
await pipeline.exec()
}
} while (cursor !== '0')
console.log(` 已处理 ${stats.modelDailyIndex}`)
@@ -93,7 +99,13 @@ async function migrate() {
console.log('\n4. 迁移 usage:model:hourly 索引...')
cursor = '0'
do {
const [newCursor, keys] = await redis.scan(cursor, 'MATCH', 'usage:model:hourly:*', 'COUNT', 500)
const [newCursor, keys] = await redis.scan(
cursor,
'MATCH',
'usage:model:hourly:*',
'COUNT',
500
)
cursor = newCursor
const pipeline = redis.pipeline()
@@ -107,7 +119,9 @@ async function migrate() {
stats.modelHourlyIndex++
}
}
if (keys.length > 0) await pipeline.exec()
if (keys.length > 0) {
await pipeline.exec()
}
} while (cursor !== '0')
console.log(` 已处理 ${stats.modelHourlyIndex}`)