Stop consumers from committing past failed offsets, harden Rabbit/DataLake/gateway backpressure, dispose JsonDocument/MinIO correctly, and batch expensive DB/HTTP paths. Track progress in docs/performance.
1.5 KiB
1.5 KiB
Phase 43 — Throughput Hot Paths
| Field | Value |
|---|---|
| Status | Complete |
| Audit findings | 6, 9, 10, 11, 12, 13 |
| Depends on | Phase 42 |
Goal
Cut DB and HTTP round-trips under peak traffic and gateway catch-up without changing clinical scoring semantics.
What to build
- Clinical sync: removed nested TX around ApplySyncedObservation (SaveChanges + Clear on conflict)
- PHI list audit:
LogViewsAsyncbatch + one SaveChanges - Reconciliation checks: preload open keys + single SaveChanges
- Ward
AddHttpClient("central"): BaseAddress + 30s timeout; per-request headers (no DefaultRequestHeaders mutation) - Encounter replica sync: upsert from list summary when patient exists; detail GET only for new patients
- Encounter timeline: 7-day window + Take(500) per event type
- Ward list: latest-per-encounter GroupBy/First for NEWS2/SOFA/GCS/sepsis
Key files
ClinicalSyncBatchProcessor.cs,ObservationService.csPatientService.cs,PhiAccessLogService.cs- Reconciliation checks under
BackgroundServices/Reconciliation/ VigilCare.WardGateway/Program.cs,EncounterReplicaSyncService.csEncounterService.cs
Acceptance criteria
- Fewer commits per sync batch / patient list / reconciliation run
- Named HttpClient configured once with timeout
- Timeline and ward-list score queries bounded
- Relevant tests green
Verification notes
- API + WardGateway build green after changes.
- Focused unit tests (PoisonPill/KafkaConsumerRetry/DataLakeEventParser) green.