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:
@@ -51,7 +51,7 @@ public class ThresholdCacheLoader : IHostedService
|
||||
{
|
||||
try
|
||||
{
|
||||
WriteThresholds(redis, thresholds);
|
||||
await WriteThresholdsAsync(redis, thresholds);
|
||||
logger.LogInformation(
|
||||
"Loaded {Count} alert thresholds into gateway Redis cache", thresholds.Count);
|
||||
return;
|
||||
@@ -73,10 +73,12 @@ public class ThresholdCacheLoader : IHostedService
|
||||
maxAttempts);
|
||||
}
|
||||
|
||||
private static void WriteThresholds(IConnectionMultiplexer redis, List<ReplicaAlertThreshold> thresholds)
|
||||
private static async Task WriteThresholdsAsync(
|
||||
IConnectionMultiplexer redis, List<ReplicaAlertThreshold> thresholds)
|
||||
{
|
||||
var cache = redis.GetDatabase();
|
||||
var batch = cache.CreateBatch();
|
||||
var setTasks = new List<Task>(thresholds.Count);
|
||||
|
||||
foreach (var t in thresholds)
|
||||
{
|
||||
@@ -86,9 +88,10 @@ public class ThresholdCacheLoader : IHostedService
|
||||
t.WarningLow,
|
||||
t.WarningHigh,
|
||||
t.CriticalHigh));
|
||||
_ = batch.StringSetAsync($"threshold:{t.ObservationCode}", json);
|
||||
setTasks.Add(batch.StringSetAsync($"threshold:{t.ObservationCode}", json));
|
||||
}
|
||||
|
||||
batch.Execute();
|
||||
await Task.WhenAll(setTasks);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user