Bladeren bron

fix: avoid multiple existing message

Yeuoly 6 maanden geleden
bovenliggende
commit
4e8d9c4e5e
2 gewijzigde bestanden met toevoegingen van 9 en 8 verwijderingen
  1. 0 0
      internal/cluster/cluster_lifetime.go
  2. 9 8
      internal/core/plugin_manager/lifetime.go

internal/cluster/lifetime.go → internal/cluster/cluster_lifetime.go


+ 9 - 8
internal/core/plugin_manager/lifetime.go

@@ -18,16 +18,14 @@ func (p *PluginManager) fullDuplexLifecycle(
 	launchedChan chan bool,
 	errChan chan error,
 ) {
-	configuration := r.Configuration()
-
-	log.Info("new plugin logged in: %s", configuration.Identity())
-	defer log.Info("plugin %s has exited", configuration.Identity())
+	// stop plugin when the plugin reaches the end of its lifetime
+	defer r.Stop()
 
 	// cleanup plugin runtime state and working directory
 	defer r.Cleanup()
 
-	// stop plugin when the plugin reaches the end of its lifetime
-	defer r.Stop()
+	// remove lifetime state after plugin if it has been stopped
+	defer r.TriggerStop()
 
 	// register plugin
 	for _, reg := range p.pluginRegisters {
@@ -38,8 +36,11 @@ func (p *PluginManager) fullDuplexLifecycle(
 		}
 	}
 
-	// remove lifetime state after plugin if it has been stopped
-	defer r.TriggerStop()
+	configuration := r.Configuration()
+	log.Info("new plugin logged in: %s", configuration.Identity())
+	defer func() {
+		log.Info("plugin %s has exited", configuration.Identity())
+	}()
 
 	// try to init environment until succeed
 	failedTimes := 0