bypass notifier limits if the state is changing first time with that event.

pull/241/head
Tufan Baris Yildirim 2019-09-06 00:48:27 +03:00
parent 23b6c39623
commit 4da56523f3
1 changed files with 2 additions and 2 deletions

View File

@ -35,7 +35,7 @@ func OnFailure(s *types.Service, f *types.Failure) {
return
}
for _, comm := range AllCommunications {
if isType(comm, new(BasicEvents)) && isEnabled(comm) && inLimits(comm) {
if isType(comm, new(BasicEvents)) && isEnabled(comm) && (s.Online || inLimits(comm)) {
comm.(BasicEvents).OnFailure(s, f)
}
}
@ -48,7 +48,7 @@ func OnSuccess(s *types.Service) {
return
}
for _, comm := range AllCommunications {
if isType(comm, new(BasicEvents)) && isEnabled(comm) && inLimits(comm) {
if isType(comm, new(BasicEvents)) && isEnabled(comm) && (!s.Online || inLimits(comm)) {
comm.(BasicEvents).OnSuccess(s)
}
}