long poller

This commit is contained in:
insanity@loafle.com 2017-05-11 20:07:05 +09:00
parent fbd63c533e
commit 37b37b5870
2 changed files with 3 additions and 3 deletions

View File

@ -9,12 +9,12 @@ func handleConfigLoaded() {
ch := make(chan interface{}, 0) ch := make(chan interface{}, 0)
observer.Add(messages.CFG_LOADED, ch) observer.Add(messages.CFG_LOADED, ch)
startPoller(ch) startPoller(ch)
observer.Remove(messages.CFG_LOADED, ch) //observer.Remove(messages.CFG_LOADED, ch)
} }
func (p *Poller) handleAgentStop() { func (p *Poller) handleAgentStop() {
ch := make(chan interface{}, 0) ch := make(chan interface{}, 0)
observer.Add(messages.AGT_STOPPED, ch) observer.Add(messages.AGT_STOPPED, ch)
p.Stop() p.Stop()
observer.Remove(messages.AGT_STOPPED, ch) //observer.Remove(messages.AGT_STOPPED, ch)
} }

View File

@ -15,6 +15,6 @@ func TestPolling(t *testing.T) {
func TestTotal(t *testing.T) { func TestTotal(t *testing.T) {
time.Sleep(time.Second * 5) time.Sleep(time.Second * 5)
observer.Notify(messages.CONFIGMANAGER_LOADED, "") //CONFIG LOCATION observer.Notify(messages.CFG_LOADED, "") //CONFIG LOCATION
time.Sleep(time.Second * 100) time.Sleep(time.Second * 100)
} }