diff --git a/src/lib/core/pouch/commands/HelloCommand.js b/src/lib/core/pouch/commands/HelloCommand.js index 06cf96f..076010b 100644 --- a/src/lib/core/pouch/commands/HelloCommand.js +++ b/src/lib/core/pouch/commands/HelloCommand.js @@ -26,8 +26,8 @@ class HelloCommand extends BasePouchCommand { */ async loadRoleRegistry () { try { - // 强制刷新资源发现,确保能发现新创建的角色 - await this.resourceManager.forceRefresh() + // 使用新的ResourceManager架构初始化 + await this.resourceManager.initializeWithNewArchitecture() // 获取所有角色相关的资源 const roleRegistry = {} diff --git a/src/lib/core/resource/resourceManager.js b/src/lib/core/resource/resourceManager.js index 09a4d93..ffa9df1 100644 --- a/src/lib/core/resource/resourceManager.js +++ b/src/lib/core/resource/resourceManager.js @@ -189,25 +189,7 @@ class ResourceManager { return await protocol.resolve(parsed.path, parsed.queryParams) } - /** - * 强制重新初始化资源发现(清除缓存) - * 用于解决新创建角色无法被发现的问题 - */ - async forceRefresh() { - // 1. 清除ResourceManager的初始化状态 - this.initialized = false - - // 2. 清空注册表 - this.registry.clear() - - // 3. 清除所有发现器的缓存 - if (this.discoveryManager && this.discoveryManager.clearCache) { - this.discoveryManager.clearCache() - } - - // 4. 重新初始化 - await this.initializeWithNewArchitecture() - } + /** * 获取所有已注册的协议 @@ -281,6 +263,8 @@ class ResourceManager { } } } + + } module.exports = ResourceManager \ No newline at end of file