feat(usage): split throttle thresholds per bucket, add draggable gauge markers

This commit is contained in:
mika kuns
2026-08-07 11:01:45 +02:00
parent 231b063751
commit 7eeb8f5086
33 changed files with 2289 additions and 147 deletions
+10 -7
View File
@@ -242,16 +242,18 @@ public sealed class QueueService : BackgroundService
public async Task<(int Configured, int Effective)> GetSlotCountsAsync(CancellationToken ct)
{
int configured;
int softPct, hardPct, gateFivePct, gateSevenPct;
UsageThresholds fiveHour, sevenDay;
try
{
using var context = _dbFactory.CreateDbContext();
var settings = await new AppSettingsRepository(context).GetAsync(ct);
configured = Math.Max(1, settings.MaxParallelExecutions);
softPct = settings.UsageThrottleSoftPct;
hardPct = settings.UsageThrottleHardPct;
gateFivePct = settings.UsageGateFiveHourPct;
gateSevenPct = settings.UsageGateSevenDayPct;
fiveHour = new UsageThresholds(
settings.UsageThrottleFiveHourSoftPct, settings.UsageThrottleFiveHourHardPct,
settings.UsageGateFiveHourPct);
sevenDay = new UsageThresholds(
settings.UsageThrottleSevenDaySoftPct, settings.UsageThrottleSevenDayHardPct,
settings.UsageGateSevenDayPct);
}
catch (Exception ex)
{
@@ -267,8 +269,9 @@ public sealed class QueueService : BackgroundService
}
var effective = UsageThrottle.EffectiveSlots(
configured, snapshot.FiveHour?.Utilization, snapshot.SevenDay?.Utilization,
softPct, hardPct, gateFivePct, gateSevenPct);
configured,
snapshot.FiveHour?.Utilization, fiveHour,
snapshot.SevenDay?.Utilization, sevenDay);
ReportThrottleTransition(configured, effective, snapshot);
return (configured, effective);