#9 Made refresh rate configurable. Also resize dbuttons and removed debugging code
This commit is contained in:
parent
365e4a882c
commit
a540221b7f
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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": "*"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue