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:
@@ -1,5 +1,6 @@
|
||||
using System.Text.Json;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
using StackExchange.Redis;
|
||||
|
||||
public class LocalObservationService : ILocalObservationService
|
||||
@@ -8,6 +9,7 @@ public class LocalObservationService : ILocalObservationService
|
||||
private readonly IConnectionMultiplexer _redis;
|
||||
private readonly LocalWarningEvaluator _warnings;
|
||||
private readonly LocalPagingPublisher _paging;
|
||||
private readonly GatewayOptions _gateway;
|
||||
private readonly ILogger<LocalObservationService> _logger;
|
||||
|
||||
public LocalObservationService(
|
||||
@@ -15,12 +17,14 @@ public class LocalObservationService : ILocalObservationService
|
||||
IConnectionMultiplexer redis,
|
||||
LocalWarningEvaluator warnings,
|
||||
LocalPagingPublisher paging,
|
||||
IOptions<GatewayOptions> gateway,
|
||||
ILogger<LocalObservationService> logger)
|
||||
{
|
||||
_db = db;
|
||||
_redis = redis;
|
||||
_warnings = warnings;
|
||||
_paging = paging;
|
||||
_gateway = gateway.Value;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@@ -94,7 +98,8 @@ public class LocalObservationService : ILocalObservationService
|
||||
severity = alert.Severity.ToDbString(),
|
||||
alert.Details,
|
||||
generatedAt = triggeredAt
|
||||
}, $"alert:{alert.ClientAlertId}", encounterId, triggeredAt);
|
||||
}, $"alert:{alert.ClientAlertId}", encounterId, triggeredAt,
|
||||
_gateway.MaxBufferedSyncItems);
|
||||
|
||||
await _paging.PublishCriticalAsync(alert, encounter);
|
||||
}
|
||||
@@ -114,7 +119,8 @@ public class LocalObservationService : ILocalObservationService
|
||||
req.Unit,
|
||||
source = req.Source.ToDbString(),
|
||||
req.RecordedAt
|
||||
}, req.IdempotencyKey ?? $"obs:{observation.Id}", encounterId, req.RecordedAt);
|
||||
}, req.IdempotencyKey ?? $"obs:{observation.Id}", encounterId, req.RecordedAt,
|
||||
_gateway.MaxBufferedSyncItems);
|
||||
|
||||
await _db.SaveChangesAsync();
|
||||
await tx.CommitAsync();
|
||||
|
||||
Reference in New Issue
Block a user