Ejemplo n.º 1
0
// Run the service
func (self *Service) Run() error {
	gr = graphite.New(services.Config.Graphite.Host)
	for ev := range services.Subscriber.Channel() {
		sendToGraphite(ev)
	}
	return nil
}
Ejemplo n.º 2
0
// Run the service
func (self *Service) Run() error {
	gr = graphite.New(services.Config.Graphite.Host)
	// schedule at given time and interval
	ticker := util.NewScheduler(services.Config.Irrigation.At.Duration,
		services.Config.Irrigation.Interval.Duration)
	for t := range ticker.C {
		tick(t)
	}
	return nil
}
Ejemplo n.º 3
0
// Run the service
func (self *Service) Run() error {
	// initialise
	gr = graphite.New(services.Config.Graphite.Host)

	// schedule at 00:02
	offset, _ := time.ParseDuration("2m")
	repeat, _ := time.ParseDuration("24h")
	ticker := util.NewScheduler(offset, repeat)
	for t := range ticker.C {
		tick(t)
	}
	return nil
}
Ejemplo n.º 4
0
// Run the service
func (service *Service) Run() error {
	gr = graphite.New(services.Config.Graphite.Host)
	// schedule at 08:00
	offset, _ := time.ParseDuration("8h")
	repeat, _ := time.ParseDuration("24h")
	ticker := util.NewScheduler(offset, repeat)
	events := services.Subscriber.FilteredChannel("rain", "temp", "wind")
	for {
		select {
		case ev := <-events:
			checkEvent(ev)
		case <-ticker.C:
			tick()
		}
	}
}