From 39b07e178d88ad0851f5bc65307ecb31c8ca1c49 Mon Sep 17 00:00:00 2001 From: Timothy Date: Thu, 16 Jul 2026 22:15:46 +0200 Subject: [PATCH] fix(channels): swallow rollback delete exceptions in auto-tune handler DeleteSmartCollection rollback in CreateAutoTunedChannelsHandler.CreateOne was called without exception handling; a transient infra exception during the best-effort rollback would propagate and abort the whole batch, contradicting the comment's stated intent. Wrap the send in try/catch so an orphaned SmartCollection is the accepted degraded outcome instead. --- .../Channels/CreateAutoTunedChannelsHandler.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ErsatzTV.Application/Channels/CreateAutoTunedChannelsHandler.cs b/ErsatzTV.Application/Channels/CreateAutoTunedChannelsHandler.cs index 6629871db..e523b558a 100644 --- a/ErsatzTV.Application/Channels/CreateAutoTunedChannelsHandler.cs +++ b/ErsatzTV.Application/Channels/CreateAutoTunedChannelsHandler.cs @@ -92,7 +92,17 @@ public class CreateAutoTunedChannelsHandler(ISender mediator) // Roll back the smart collection we just created so a retry of this // axis/value doesn't fail on SmartCollection-name uniqueness. Best-effort; // the primary outcome below is still Skipped/Failed regardless of the delete result. - await mediator.Send(new DeleteSmartCollection(smartCollection.Id), cancellationToken); + // Swallow any exception (not just an Either.Left) so a transient infra failure + // during rollback never aborts this channel's outcome or the batch; the + // orphaned SmartCollection is an acceptable degraded outcome. + try + { + await mediator.Send(new DeleteSmartCollection(smartCollection.Id), cancellationToken); + } + catch (Exception) + { + // intentionally ignored; see comment above + } AutoTuneOutcomeStatus status = error.Value.Contains(NumberTakenError, StringComparison.Ordinal) ? AutoTuneOutcomeStatus.Skipped