Merge pull request #241 from tufanbarisyildirim/feature/notify-state-change

bypass notifier limits if the state is changing first time with that event
pull/143/head^2
Hunter Long 2019-10-15 08:56:53 -07:00 committed by GitHub
commit 37ed995fb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -52,7 +52,7 @@ func OnFailure(s *types.Service, f *types.Failure) {
sendMessages:
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()
utils.Log(1, fmt.Sprintf("Sending failure %v notification for service %v", notifier.Method, s.Name))
comm.(BasicEvents).OnFailure(s, f)
@ -72,7 +72,7 @@ func OnSuccess(s *types.Service) {
}
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()
utils.Log(1, fmt.Sprintf("Sending successful %v notification for service %v", notifier.Method, s.Name))
comm.(BasicEvents).OnSuccess(s)