megaease / easeprobe

A simple, standalone, and lightweight tool that can do health/status checking, written in Go.
Apache License 2.0
2.16k stars 228 forks source link

fix multi failure notify #524

Closed suchen-sci closed 4 months ago

suchen-sci commented 4 months ago

Fix #523

In channel.go within the Channel.WatchEvent function, the code checks result and uses its information to decide whether to send a notification. However, in notification_strategy.go, the NotificationStrategyData.ProcessStatus function updates the status and the number of notifications sent.

This means that in the case of #523, since the failure count is set to 2 and a failure occurs in the init state, the channel does not send a notification because it is in the init state. However, NotificationStrategyData considers the notification already sent and IsExceedMaxTimes returns true.

As a result, no notification is sent. To fix this problem, when in the init state, NotificationStrategyData should not be updated. According to the logic and comments in channel.go, init is a special state. This fix should be fine.