make speedtest rate limit to remote config and default to 0.5h

This commit is contained in:
Stanley Dimant
2024-11-11 19:16:07 +01:00
parent 0d72e3b40e
commit 532c123927
2 changed files with 3 additions and 2 deletions

View File

@@ -26,7 +26,7 @@ public class SpeedTestController : ControllerBase
public async Task<IActionResult> DownloadTest(CancellationToken cancellationToken)
{
var user = HttpContext.User.Claims.First(f => string.Equals(f.Type, MareClaimTypes.Uid, StringComparison.Ordinal)).Value;
var speedtestLimit = _configurationService.GetValueOrDefault(nameof(StaticFilesServerConfiguration.SpeedTestHoursRateLimit), 6);
var speedtestLimit = _configurationService.GetValueOrDefault(nameof(StaticFilesServerConfiguration.SpeedTestHoursRateLimit), 0.5);
if (_memoryCache.TryGetValue<DateTime>(user, out var value))
{
var hoursRemaining = value.Subtract(DateTime.UtcNow).TotalHours;