From c17197f30ba6339431e743bf3244b58ef7361115 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 4 Aug 2021 10:30:09 -0500 Subject: return 409 if share scan is in progress --- .../Management/API/Controllers/ConfigurationController.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/slskd/Application/Management/API/Controllers/ConfigurationController.cs') diff --git a/src/slskd/Application/Management/API/Controllers/ConfigurationController.cs b/src/slskd/Application/Management/API/Controllers/ConfigurationController.cs index 26ce6c52..c44cf2f2 100644 --- a/src/slskd/Application/Management/API/Controllers/ConfigurationController.cs +++ b/src/slskd/Application/Management/API/Controllers/ConfigurationController.cs @@ -19,7 +19,6 @@ using Microsoft.Extensions.Options; namespace slskd.Application.Management.API { - using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using slskd.Management; @@ -50,6 +49,7 @@ namespace slskd.Application.Management.API private IStateMonitor SharedFileCacheMonitor { get; } [HttpGet] + [Route("")] [Authorize] public IActionResult GetOptions() { @@ -58,18 +58,17 @@ namespace slskd.Application.Management.API } [HttpPut] + [Route("shares")] [Authorize] - public async Task RescanSharesAsync() + public IActionResult RescanSharesAsync() { - try + if (SharedFileCacheMonitor.CurrentValue.Filling) { - await ManagementService.RescanSharesAsync(); - } - catch (ShareScanInProgressException ex) - { - return Conflict(ex.Message); + return Conflict("A share scan is already in progress."); } + _ = ManagementService.RescanSharesAsync(); + return Ok(); } } -- cgit v1.2.3