dummie_executor.go 512 B

1234567891011121314151617181920212223
  1. package alerting
  2. import (
  3. "github.com/grafana/grafana/pkg/log"
  4. m "github.com/grafana/grafana/pkg/models"
  5. "time"
  6. )
  7. type Executor interface {
  8. Execute(rule m.AlertRule, responseQueue chan *AlertResult)
  9. }
  10. type DummieExecutor struct{}
  11. func (this *DummieExecutor) Execute(rule m.AlertRule, responseQueue chan *AlertResult) {
  12. if rule.Id == 6 {
  13. time.Sleep(time.Second * 0)
  14. }
  15. //time.Sleep(time.Second)
  16. log.Info("Finnished executing: %d", rule.Id)
  17. responseQueue <- &AlertResult{State: "OK", Id: rule.Id}
  18. }