diff --git a/Models/TimerClass.cs b/Models/TimerClass.cs index 38dcea7..76f5133 100644 --- a/Models/TimerClass.cs +++ b/Models/TimerClass.cs @@ -20,6 +20,8 @@ namespace AutoNotificatPhone.Models // 消息控制器实例 private readonly CallAndMsgController _callAndMsgController = new(); private readonly IConfiguration _configuration; + // Kafka数据库连接失败累计次数 + private int _kafkaDbConnectionAlertCount = 0; public TimerClass(IConfiguration configuration) { @@ -555,12 +557,20 @@ namespace AutoNotificatPhone.Models /// private void ExecuteKafkaDbConnectionAlert() { + _kafkaDbConnectionAlertCount++; + if (_kafkaDbConnectionAlertCount < 8) + { + return; + } + SendAlert( smsContent: "[BLV运维提示] 数据库连接失败!", callContent: "[BLV运维提示] 数据库连接失败", alertType: "BLS-数据库连接警报", extendedDeadline: true ); + + _kafkaDbConnectionAlertCount = 0; } ///