tech(alerting): change from array to map

This commit is contained in:
bergquist
2016-05-23 17:04:57 +02:00
parent 77ec575b46
commit 7229fb7a76
5 changed files with 74 additions and 45 deletions

View File

@ -7,16 +7,17 @@ import (
)
type Executor interface {
Execute(rule m.AlertRule) (err error, result AlertResult)
Execute(rule m.AlertRule, responseQueue chan *AlertResult)
}
type DummieExecutor struct{}
func (this DummieExecutor) Execute(rule m.AlertRule) (err error, result AlertResult) {
if rule.Id == 6 {
time.Sleep(time.Second * 60)
}
func (this DummieExecutor) Execute(rule m.AlertRule, responseQueue chan *AlertResult) {
//if rule.Id == 6 {
// time.Sleep(time.Second * 60)
//}
time.Sleep(time.Second)
log.Info("Finnished executing: %d", rule.Id)
return nil, AlertResult{state: "OK", id: rule.Id}
responseQueue <- &AlertResult{state: "OK", id: rule.Id}
//return nil,
}