#9 Made refresh rate configurable. Also resize dbuttons and removed debugging code

This commit is contained in:
henry 2025-05-15 19:44:32 -04:00
parent 365e4a882c
commit a540221b7f
3 changed files with 11 additions and 13 deletions

View File

@ -38,7 +38,7 @@
</GridColumn>
<GridColumn TItem="User" HeaderText="Revoke">
<ChildContent>
<Button Color="ButtonColor.Danger" @onclick="() => RevokeAccess(context.Id)">Revoke Access</Button>
<Button Size="ButtonSize.ExtraSmall" Color="ButtonColor.Danger" @onclick="() => RevokeAccess(context.Id)">Revoke Access</Button>
</ChildContent>
</GridColumn>
</GridColumns>
@ -59,7 +59,7 @@
</GridColumn>
<GridColumn TItem="User" HeaderText="Revoke">
<ChildContent>
<Button Color="ButtonColor.Danger" @onclick="() => RevokeAccess(context.Id)">Revoke Access</Button>
<Button Size="ButtonSize.ExtraSmall" Color="ButtonColor.Danger" @onclick="() => RevokeAccess(context.Id)">Revoke Access</Button>
</ChildContent>
</GridColumn>
</GridColumns>

View File

@ -7,27 +7,22 @@ namespace AccessQueuePlayground.Services
public class AccessQueueBackgroundService : BackgroundService
{
private readonly IAccessQueueManager _accessQueueManager;
private readonly IConfiguration _config;
public AccessQueueBackgroundService(IAccessQueueManager accessQueueManager)
public AccessQueueBackgroundService(IAccessQueueManager accessQueueManager, IConfiguration config)
{
_accessQueueManager = accessQueueManager;
_config = config;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
int refreshRate = _config.GetValue<int>("AccessQueuePlayground:RefreshRateMilliseconds");
while (!stoppingToken.IsCancellationRequested)
{
try
{
await _accessQueueManager.RecalculateStatus();
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
await Task.Delay(100, stoppingToken); // Run every second
}
Console.WriteLine("Stopping now because who tf knows why");
await Task.Delay(refreshRate, stoppingToken);
}
}
}
}

View File

@ -11,5 +11,8 @@
"ExpirationSeconds": 10, // 12 hours - Time before a user access is revoked
"RollingExpiration": true // Whether to extend expiration time on access
},
"AccessQueuePlayground": {
"RefreshRateMilliseconds": 200 // How often to re-request access and update the UI
},
"AllowedHosts": "*"
}