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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user