long_poller_go/poller_event.go
insanity@loafle.com 254b3f9392 long poller
2017-05-15 14:48:08 +09:00

28 lines
604 B
Go

package long_poller_go
import (
"loafle.com/overflow/agent_api/observer"
"loafle.com/overflow/agent_api/observer/messages"
)
func handleConfigLoaded() {
ch := make(chan interface{}, 0)
observer.Add(messages.CFG_LOADED, ch)
startPoller(ch)
}
func (p *Poller) handleAgentStop() {
ch := make(chan interface{}, 0)
observer.Add(messages.AGT_STOPPED, ch)
_ = <- ch
p.Stop(ch)
}
func (p *Poller) removeConfigLoadedHandler(ch chan interface{}) {
observer.Remove(messages.CFG_LOADED, ch)
}
func (p *Poller) removeAgentStopHandler(ch chan interface{}) {
observer.Remove(messages.AGT_STOPPED, ch)
}