@@ -143,13 +143,31 @@ public async Task<bool> SendCombinedWeeklyAsync(IReadOnlyList<string> roundupSlu
143143 successful ++ ;
144144 }
145145
146- await _subscriberRepository . RecordSubscriberSendAsync ( subscriber . Email , isWeekly : true , succeeded : emailSent , ct ) ;
146+ #pragma warning disable CA1031 // Best-effort: status recording must not affect the send result
147+ try
148+ {
149+ await _subscriberRepository . RecordSubscriberSendAsync ( subscriber . Email , isWeekly : true , succeeded : emailSent , ct ) ;
150+ }
151+ catch ( Exception dbEx ) when ( dbEx is not OperationCanceledException )
152+ {
153+ _logger . LogWarning ( dbEx , "Failed recording weekly send status for subscriber — continuing" ) ;
154+ }
155+ #pragma warning restore CA1031
147156 }
148157#pragma warning disable CA1031 // Best-effort: continue with other subscribers if one fails
149158 catch ( Exception ex ) when ( ex is not OperationCanceledException )
150159 {
151160 _logger . LogWarning ( ex , "Failed sending weekly newsletter to subscriber — skipping" ) ;
152- await _subscriberRepository . RecordSubscriberSendAsync ( subscriber . Email , isWeekly : true , succeeded : false , CancellationToken . None ) ;
161+ #pragma warning disable CA1031 // Best-effort: status recording must not abort the loop
162+ try
163+ {
164+ await _subscriberRepository . RecordSubscriberSendAsync ( subscriber . Email , isWeekly : true , succeeded : false , CancellationToken . None ) ;
165+ }
166+ catch ( Exception dbEx ) when ( dbEx is not OperationCanceledException )
167+ {
168+ _logger . LogWarning ( dbEx , "Failed recording weekly send failure status for subscriber — continuing" ) ;
169+ }
170+ #pragma warning restore CA1031
153171 }
154172#pragma warning restore CA1031
155173 }
@@ -421,13 +439,31 @@ public async Task<bool> SendDailyOverviewAsync(DateOnly day, CancellationToken c
421439 sent ++ ;
422440 }
423441
424- await _subscriberRepository . RecordSubscriberSendAsync ( subscriber . Email , isWeekly : false , succeeded : emailSent , ct ) ;
442+ #pragma warning disable CA1031 // Best-effort: status recording must not affect the send result
443+ try
444+ {
445+ await _subscriberRepository . RecordSubscriberSendAsync ( subscriber . Email , isWeekly : false , succeeded : emailSent , ct ) ;
446+ }
447+ catch ( Exception dbEx ) when ( dbEx is not OperationCanceledException )
448+ {
449+ _logger . LogWarning ( dbEx , "Failed recording daily send status for subscriber — continuing" ) ;
450+ }
451+ #pragma warning restore CA1031
425452 }
426453#pragma warning disable CA1031 // Best-effort: continue with other subscribers if one fails
427454 catch ( Exception ex ) when ( ex is not OperationCanceledException )
428455 {
429456 _logger . LogWarning ( ex , "Failed sending daily newsletter to subscriber — skipping" ) ;
430- await _subscriberRepository . RecordSubscriberSendAsync ( subscriber . Email , isWeekly : false , succeeded : false , CancellationToken . None ) ;
457+ #pragma warning disable CA1031 // Best-effort: status recording must not abort the loop
458+ try
459+ {
460+ await _subscriberRepository . RecordSubscriberSendAsync ( subscriber . Email , isWeekly : false , succeeded : false , CancellationToken . None ) ;
461+ }
462+ catch ( Exception dbEx ) when ( dbEx is not OperationCanceledException )
463+ {
464+ _logger . LogWarning ( dbEx , "Failed recording daily send failure status for subscriber — continuing" ) ;
465+ }
466+ #pragma warning restore CA1031
431467 }
432468#pragma warning restore CA1031
433469 }
0 commit comments