feat(usage): split throttle thresholds per bucket, add draggable gauge markers
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user