diff --git a/init_method.go b/init_method.go index 5b0e8d7..b205478 100644 --- a/init_method.go +++ b/init_method.go @@ -7,7 +7,7 @@ import ( func agentStartHandler() { agentStart := make(chan interface{}, 0) - observer.Add(messages.AGENT_STARTED, agentStart) + observer.Add(messages.AGT_STARTING, agentStart) go func() { data := <-agentStart path := data.(string) @@ -19,17 +19,17 @@ func agentStartHandler() { // error process } - observer.Remove(messages.AGENT_STARTED, agentStart) + observer.Remove(messages.AGT_STARTING, agentStart) observer.Notify(messages.CFG_LOADED, _configManager) }() } func agentEndHandler() { agentEnd := make(chan interface{}, 0) - observer.Add(messages.AGENT_WILL_STOPPED, agentEnd) + observer.Add(messages.AGT_WILL_STOPPED, agentEnd) go func() { _ = <-agentEnd - observer.Remove(messages.AGENT_WILL_STOPPED, agentEnd) + observer.Remove(messages.AGT_WILL_STOPPED, agentEnd) observer.Remove(messages.TASK_SENSOR_ADD,_configManager.addCh) observer.Remove(messages.TASK_SENSOR_REMOVE,_configManager.removeCh) }()