修正getAllUsers(),修正启动时自动迁移执行多次
This commit is contained in:
@@ -645,13 +645,12 @@ export abstract class BaseRedisStorage implements IStorage {
|
||||
|
||||
// ---------- 获取全部用户 ----------
|
||||
async getAllUsers(): Promise<string[]> {
|
||||
const keys = await this.withRetry(() => this.client.keys('u:*:pwd'));
|
||||
return keys
|
||||
.map((k) => {
|
||||
const match = k.match(/^u:(.+?):pwd$/);
|
||||
return match ? ensureString(match[1]) : undefined;
|
||||
})
|
||||
.filter((u): u is string => typeof u === 'string');
|
||||
// 从新版用户列表获取
|
||||
const userListKey = this.userListKey();
|
||||
const users = await this.withRetry(() =>
|
||||
this.client.zRange(userListKey, 0, -1)
|
||||
);
|
||||
return users.map(u => ensureString(u));
|
||||
}
|
||||
|
||||
// ---------- 管理员配置 ----------
|
||||
|
||||
Reference in New Issue
Block a user