fix:刷新缓存

This commit is contained in:
sean
2025-06-12 17:31:02 +08:00
parent f9bbc55069
commit 29652ca8fb
3 changed files with 26 additions and 10 deletions

View File

@ -83,14 +83,10 @@ ${COMMANDS.HELLO}
async getRoleInfo (roleId) {
logger.debug(`[ActionCommand] getRoleInfo调用角色ID: ${roleId}`)
// 懒加载HelloCommand实例
if (!this.helloCommand) {
logger.debug(`[ActionCommand] 创建新的HelloCommand实例`)
const HelloCommand = require('./HelloCommand')
this.helloCommand = new HelloCommand()
} else {
logger.debug(`[ActionCommand] 复用现有HelloCommand实例`)
}
// 总是创建新的HelloCommand实例,确保获取最新的角色信息
logger.debug(`[ActionCommand] 创建新的HelloCommand实例以获取最新角色信息`)
const HelloCommand = require('./HelloCommand')
this.helloCommand = new HelloCommand()
const result = await this.helloCommand.getRoleInfo(roleId)
logger.debug(`[ActionCommand] HelloCommand.getRoleInfo返回:`, result)

View File

@ -26,8 +26,8 @@ class HelloCommand extends BasePouchCommand {
*/
async loadRoleRegistry () {
try {
// 使用新的ResourceManager架构初始化
await this.resourceManager.initializeWithNewArchitecture()
// 强制刷新资源发现,确保能发现新创建的角色
await this.resourceManager.forceRefresh()
// 获取所有角色相关的资源
const roleRegistry = {}