collector

This commit is contained in:
insanity@loafle.com 2017-05-11 19:05:37 +09:00
parent f980983015
commit 7d45006130
2 changed files with 4 additions and 6 deletions

View File

@ -80,7 +80,7 @@ func (c *Collector) addObservers() {
go c.handleCrawlerUpdateDone()
}
func (c *Collector) Stop() {
func (c *Collector) Stop(d interface{}) {
c.cleanObserver(c.addSensorCh, c.remSensorCh)
c.scheduler.RemoveAllSchedule()
c.scheduler.Stop()

View File

@ -28,12 +28,10 @@ func (c *Collector) notifyCollectorStopped() {
func (c *Collector) handleAgentWillStop() {
ch := make(chan interface{}, 0)
observer.Add(messages.AGT_WILL_STOPPED, ch)
observer.Add(messages.AGT_WILL_STOP, ch)
data := <-ch
if data {
c.Stop()
}
observer.Remove(messages.AGT_WILL_STOPPED, ch)
c.Stop(data)
observer.Remove(messages.AGT_WILL_STOP, ch)
}
func (c *Collector) handleSensorStart() {