AGENT_STARTING change

This commit is contained in:
geek 2017-05-11 18:02:10 +09:00
parent 57646371c0
commit ac6eb35e35

View File

@ -7,7 +7,7 @@ import (
func agentStartHandler() { func agentStartHandler() {
agentStart := make(chan interface{}, 0) agentStart := make(chan interface{}, 0)
observer.Add(messages.AGENT_STARTED, agentStart) observer.Add(messages.AGT_STARTING, agentStart)
go func() { go func() {
data := <-agentStart data := <-agentStart
path := data.(string) path := data.(string)
@ -19,17 +19,17 @@ func agentStartHandler() {
// error process // error process
} }
observer.Remove(messages.AGENT_STARTED, agentStart) observer.Remove(messages.AGT_STARTING, agentStart)
observer.Notify(messages.CFG_LOADED, _configManager) observer.Notify(messages.CFG_LOADED, _configManager)
}() }()
} }
func agentEndHandler() { func agentEndHandler() {
agentEnd := make(chan interface{}, 0) agentEnd := make(chan interface{}, 0)
observer.Add(messages.AGENT_WILL_STOPPED, agentEnd) observer.Add(messages.AGT_WILL_STOPPED, agentEnd)
go func() { go func() {
_ = <-agentEnd _ = <-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_ADD,_configManager.addCh)
observer.Remove(messages.TASK_SENSOR_REMOVE,_configManager.removeCh) observer.Remove(messages.TASK_SENSOR_REMOVE,_configManager.removeCh)
}() }()