修改判断数据库离线逻辑为:访问失败后,重试6次后发送错误短信。

This commit is contained in:
2026-02-13 15:06:43 +08:00
parent ccf4473a57
commit 700b4549d9

View File

@@ -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
/// </summary>
private void ExecuteKafkaDbConnectionAlert()
{
_kafkaDbConnectionAlertCount++;
if (_kafkaDbConnectionAlertCount < 8)
{
return;
}
SendAlert(
smsContent: "[BLV运维提示] 数据库连接失败!",
callContent: "[BLV运维提示] 数据库连接失败",
alertType: "BLS-数据库连接警报",
extendedDeadline: true
);
_kafkaDbConnectionAlertCount = 0;
}
/// <summary>