mirror of https://github.com/statping/statping
Merge pull request #241 from tufanbarisyildirim/feature/notify-state-change
bypass notifier limits if the state is changing first time with that eventpull/143/head^2
commit
37ed995fb4
|
@ -52,7 +52,7 @@ func OnFailure(s *types.Service, f *types.Failure) {
|
||||||
|
|
||||||
sendMessages:
|
sendMessages:
|
||||||
for _, comm := range AllCommunications {
|
for _, comm := range AllCommunications {
|
||||||
if isType(comm, new(BasicEvents)) && isEnabled(comm) && inLimits(comm) {
|
if isType(comm, new(BasicEvents)) && isEnabled(comm) && (s.Online || inLimits(comm)) {
|
||||||
notifier := comm.(Notifier).Select()
|
notifier := comm.(Notifier).Select()
|
||||||
utils.Log(1, fmt.Sprintf("Sending failure %v notification for service %v", notifier.Method, s.Name))
|
utils.Log(1, fmt.Sprintf("Sending failure %v notification for service %v", notifier.Method, s.Name))
|
||||||
comm.(BasicEvents).OnFailure(s, f)
|
comm.(BasicEvents).OnFailure(s, f)
|
||||||
|
@ -72,7 +72,7 @@ func OnSuccess(s *types.Service) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, comm := range AllCommunications {
|
for _, comm := range AllCommunications {
|
||||||
if isType(comm, new(BasicEvents)) && isEnabled(comm) && inLimits(comm) {
|
if isType(comm, new(BasicEvents)) && isEnabled(comm) && (!s.Online || inLimits(comm)) {
|
||||||
notifier := comm.(Notifier).Select()
|
notifier := comm.(Notifier).Select()
|
||||||
utils.Log(1, fmt.Sprintf("Sending successful %v notification for service %v", notifier.Method, s.Name))
|
utils.Log(1, fmt.Sprintf("Sending successful %v notification for service %v", notifier.Method, s.Name))
|
||||||
comm.(BasicEvents).OnSuccess(s)
|
comm.(BasicEvents).OnSuccess(s)
|
||||||
|
|
Loading…
Reference in New Issue