#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>
|
||||||
<GridColumn TItem="User" HeaderText="Revoke">
|
<GridColumn TItem="User" HeaderText="Revoke">
|
||||||
<ChildContent>
|
<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>
|
</ChildContent>
|
||||||
</GridColumn>
|
</GridColumn>
|
||||||
</GridColumns>
|
</GridColumns>
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
</GridColumn>
|
</GridColumn>
|
||||||
<GridColumn TItem="User" HeaderText="Revoke">
|
<GridColumn TItem="User" HeaderText="Revoke">
|
||||||
<ChildContent>
|
<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>
|
</ChildContent>
|
||||||
</GridColumn>
|
</GridColumn>
|
||||||
</GridColumns>
|
</GridColumns>
|
||||||
|
|
|
@ -7,27 +7,22 @@ namespace AccessQueuePlayground.Services
|
||||||
public class AccessQueueBackgroundService : BackgroundService
|
public class AccessQueueBackgroundService : BackgroundService
|
||||||
{
|
{
|
||||||
private readonly IAccessQueueManager _accessQueueManager;
|
private readonly IAccessQueueManager _accessQueueManager;
|
||||||
|
private readonly IConfiguration _config;
|
||||||
|
|
||||||
public AccessQueueBackgroundService(IAccessQueueManager accessQueueManager)
|
public AccessQueueBackgroundService(IAccessQueueManager accessQueueManager, IConfiguration config)
|
||||||
{
|
{
|
||||||
_accessQueueManager = accessQueueManager;
|
_accessQueueManager = accessQueueManager;
|
||||||
|
_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
{
|
{
|
||||||
|
int refreshRate = _config.GetValue<int>("AccessQueuePlayground:RefreshRateMilliseconds");
|
||||||
while (!stoppingToken.IsCancellationRequested)
|
while (!stoppingToken.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
try
|
await _accessQueueManager.RecalculateStatus();
|
||||||
{
|
await Task.Delay(refreshRate, stoppingToken);
|
||||||
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");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,5 +11,8 @@
|
||||||
"ExpirationSeconds": 10, // 12 hours - Time before a user access is revoked
|
"ExpirationSeconds": 10, // 12 hours - Time before a user access is revoked
|
||||||
"RollingExpiration": true // Whether to extend expiration time on access
|
"RollingExpiration": true // Whether to extend expiration time on access
|
||||||
},
|
},
|
||||||
|
"AccessQueuePlayground": {
|
||||||
|
"RefreshRateMilliseconds": 200 // How often to re-request access and update the UI
|
||||||
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue