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.
This commit is contained in:
2026-07-16 22:18:52 +02:00
parent f31476e012
commit 39b07e178d
@@ -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