修改退出时关闭所有服务和连接

This commit is contained in:
2025-09-06 19:59:21 +08:00
parent 6f0e80e1e2
commit be16e1a5d7
4 changed files with 73 additions and 6 deletions

View File

@@ -243,5 +243,20 @@ namespace DMS.Infrastructure.Services
_logger.LogInformation("MQTT列表发生了变化正在重新加载数据...");
_reloadSemaphore.Release();
}
/// <summary>
/// 释放资源
/// </summary>
public override void Dispose()
{
_logger.LogInformation("正在释放MQTT后台服务资源...");
_dataCenterService.OnLoadDataCompleted -= OnLoadDataCompleted;
_reloadSemaphore?.Dispose();
base.Dispose();
_logger.LogInformation("MQTT后台服务资源已释放");
}
}
}