浏览代码

fix: store remote plugin runtime while init remote plugin lifecycle process

Yeuoly 9 月之前
父节点
当前提交
7fcefceaf6
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      internal/core/plugin_manager/watcher.go

+ 7 - 0
internal/core/plugin_manager/watcher.go

@@ -47,11 +47,18 @@ func (p *PluginManager) startRemoteWatcher(config *app.Config) {
 		}()
 		go func() {
 			server.Wrap(func(rpr *remote_manager.RemotePluginRuntime) {
+				identity, err := rpr.Identity()
+				if err != nil {
+					log.Error("get remote plugin identity failed: %s", err.Error())
+					return
+				}
+				p.m.Store(identity.String(), rpr)
 				routine.Submit(func() {
 					defer func() {
 						if err := recover(); err != nil {
 							log.Error("plugin runtime error: %v", err)
 						}
+						p.m.Delete(identity.String())
 					}()
 					p.fullDuplexLifetime(rpr, nil)
 				})