Fix: FHIR bundle processing has no rollback on partial failure
This commit is contained in:
@@ -113,9 +113,14 @@ public class OrderService : IOrderService
|
||||
order.ResultedAt = DateTimeOffset.UtcNow;
|
||||
order.ResultSummary = req.ResultSummary;
|
||||
|
||||
await using var tx = _db.Database.CurrentTransaction is null
|
||||
? await _db.Database.BeginTransactionAsync()
|
||||
: null;
|
||||
await _db.SaveChangesAsync();
|
||||
var bundleService = _serviceProvider.GetRequiredService<ISepsisBundleService>();
|
||||
await bundleService.OnOrderResultedAsync(order.Id);
|
||||
if (tx is not null) await tx.CommitAsync();
|
||||
|
||||
return order;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user