Skip to content

Commit 66e527a

Browse files
committed
fix(v4): let cancellation propagate through best-effort PostCommitDedup
The post-commit dedup catch-all swallowed OperationCanceledException too, silently treating a cancelled batch as a logged dedup failure. Add a when (ex is not OperationCanceledException) filter so cancellation propagates while genuine dedup failures stay best-effort (logged and healed by the reconcile service).
1 parent b8788b4 commit 66e527a

8 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/Infrastructure/Nocturne.Infrastructure.Data/Repositories/V4/BGCheckRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ protected override async Task PostCommitDedupAsync(
155155

156156
await _deduplicationService.DeduplicateBatchAsync(RecordType.BGCheck, dedupInputs, ct);
157157
}
158-
catch (Exception ex)
158+
catch (Exception ex) when (ex is not OperationCanceledException)
159159
{
160160
_logger.LogWarning(ex, "Failed to deduplicate {Type} batch of {Count}", "BGCheck", inserted.Count);
161161
}

src/Infrastructure/Nocturne.Infrastructure.Data/Repositories/V4/BolusCalculationRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ protected override async Task PostCommitDedupAsync(
143143

144144
await _deduplicationService.DeduplicateBatchAsync(RecordType.BolusCalculation, dedupInputs, ct);
145145
}
146-
catch (Exception ex)
146+
catch (Exception ex) when (ex is not OperationCanceledException)
147147
{
148148
_logger.LogWarning(ex, "Failed to deduplicate {Type} batch of {Count}", "BolusCalculation", inserted.Count);
149149
}

src/Infrastructure/Nocturne.Infrastructure.Data/Repositories/V4/BolusRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ protected override async Task PostCommitDedupAsync(
303303

304304
await _deduplicationService.DeduplicateBatchAsync(RecordType.Bolus, dedupInputs, ct);
305305
}
306-
catch (Exception ex)
306+
catch (Exception ex) when (ex is not OperationCanceledException)
307307
{
308308
_logger.LogWarning(ex, "Failed to deduplicate {Type} batch of {Count}", "Bolus", inserted.Count);
309309
}

src/Infrastructure/Nocturne.Infrastructure.Data/Repositories/V4/CarbIntakeRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ protected override async Task PostCommitDedupAsync(
302302

303303
await _deduplicationService.DeduplicateBatchAsync(RecordType.CarbIntake, dedupInputs, ct);
304304
}
305-
catch (Exception ex)
305+
catch (Exception ex) when (ex is not OperationCanceledException)
306306
{
307307
_logger.LogWarning(ex, "Failed to deduplicate {Type} batch of {Count}", "CarbIntake", inserted.Count);
308308
}

src/Infrastructure/Nocturne.Infrastructure.Data/Repositories/V4/DeviceEventRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ protected override async Task PostCommitDedupAsync(
170170

171171
await _deduplicationService.DeduplicateBatchAsync(RecordType.DeviceEvent, dedupInputs, ct);
172172
}
173-
catch (Exception ex)
173+
catch (Exception ex) when (ex is not OperationCanceledException)
174174
{
175175
_logger.LogWarning(ex, "Failed to deduplicate {Type} batch of {Count}", "DeviceEvent", inserted.Count);
176176
}

src/Infrastructure/Nocturne.Infrastructure.Data/Repositories/V4/NoteRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ protected override async Task PostCommitDedupAsync(
169169

170170
await _deduplicationService.DeduplicateBatchAsync(RecordType.Note, dedupInputs, ct);
171171
}
172-
catch (Exception ex)
172+
catch (Exception ex) when (ex is not OperationCanceledException)
173173
{
174174
_logger.LogWarning(ex, "Failed to deduplicate {Type} batch of {Count}", "Note", inserted.Count);
175175
}

src/Infrastructure/Nocturne.Infrastructure.Data/Repositories/V4/SensorGlucoseRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ protected override async Task PostCommitDedupAsync(
277277

278278
await _deduplicationService.DeduplicateBatchAsync(RecordType.SensorGlucose, dedupInputs, ct);
279279
}
280-
catch (Exception ex)
280+
catch (Exception ex) when (ex is not OperationCanceledException)
281281
{
282282
_logger.LogWarning(ex, "Failed to deduplicate {Type} batch of {Count}", "SensorGlucose", inserted.Count);
283283
}

src/Infrastructure/Nocturne.Infrastructure.Data/Repositories/V4/TempBasalRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ public async Task<IEnumerable<TempBasal>> BulkCreateAsync(
327327

328328
await _deduplicationService.DeduplicateBatchAsync(RecordType.TempBasal, dedupInputs, ct);
329329
}
330-
catch (Exception ex)
330+
catch (Exception ex) when (ex is not OperationCanceledException)
331331
{
332332
_logger.LogWarning(ex, "Failed to deduplicate {Type} batch of {Count}", "TempBasal", entities.Count);
333333
}

0 commit comments

Comments
 (0)