Fix Kafka retry seek, bound buffers, and cut hot-path CPU/memory waste (Phases 41–44).
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.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
# Phase 42 — Resource Leaks & GC
|
||||
|
||||
| Field | Value |
|
||||
|-------|-------|
|
||||
| Status | Complete |
|
||||
| Audit findings | 4, 5, 8, 15 |
|
||||
| Depends on | Phase 41 |
|
||||
|
||||
## Goal
|
||||
|
||||
Dispose pooled JSON parsers, stop creating MinIO clients per upload, reuse `JsonSerializerOptions` on Kafka hot paths, and await Redis threshold batch tasks.
|
||||
|
||||
## What to build
|
||||
|
||||
- [x] `using` for all hot-path `JsonDocument.Parse` (DataLakeEventParser + Rabbit/Kafka handlers)
|
||||
- [x] Long-lived `IMinioClient` via DI; dispose `MemoryStream` on upload
|
||||
- [x] Static shared `JsonSerializerOptions` on News2/Sofa/Gcs/Warning/Trend consumers (`ClinicalEventJson`)
|
||||
- [x] Await Redis `StringSetAsync` tasks after `batch.Execute()` in both ThresholdCacheLoaders
|
||||
|
||||
## Key files
|
||||
|
||||
- `VigilCareClinicalAPI/DataLake/DataLakeEventParser.cs`
|
||||
- `VigilCareClinicalAPI/Storage/MinioClientFactory.cs`
|
||||
- `VigilCareClinicalAPI/DataLake/DataLakeWriterService.cs`
|
||||
- Kafka scoring consumers; ThresholdCacheLoader (API + WardGateway)
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
- No undisposed JsonDocument on listed paths
|
||||
- MinIO not constructed per upload
|
||||
- Threshold cache load awaits all sets
|
||||
- DataLake parser tests pass
|
||||
|
||||
## Verification notes
|
||||
|
||||
- MinIO registered as singleton `IMinioClient` in Program.cs; DataLake/Discharge paths inject it.
|
||||
- Hot-path JsonDocument uses `using`; scoring consumers share `ClinicalEventJson.Options`.
|
||||
Reference in New Issue
Block a user