This commit is contained in:
fuenmao
2026-10-09 16:46:30 +08:00
parent 4a634ef4c2
commit e6b90a06ab
63 changed files with 4170 additions and 1518 deletions
@@ -45,7 +45,7 @@ public sealed class HomeAssistantRegistryService : ISingleton
}
return _cachedRegistries;
}
catch (Exception ex)
catch (Exception ex) when (ex is not OperationCanceledException || !cancellationToken.IsCancellationRequested)
{
_logger.LogWarning("通过 WebSocket 读取 Home Assistant 注册表失败:{Message}", ex.Message);
return _cachedRegistries;
@@ -119,7 +119,7 @@ public sealed class HomeAssistantRegistryService : ISingleton
try
{
await ws.CloseAsync(WebSocketCloseStatus.NormalClosure, "Completed", CancellationToken.None);
await ws.CloseAsync(WebSocketCloseStatus.NormalClosure, "Completed", cts.Token);
}
catch
{
@@ -134,7 +134,7 @@ public sealed class HomeAssistantRegistryService : ISingleton
CachedAt = DateTimeOffset.UtcNow
};
}
catch (Exception ex)
catch (Exception ex) when (ex is not OperationCanceledException || !cancellationToken.IsCancellationRequested)
{
_logger.LogWarning("连接 Home Assistant WebSocket 发生异常:{Message}", ex.Message);
return null;