aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Shares/API/Controllers
diff options
context:
space:
mode:
Diffstat (limited to 'src/slskd/Shares/API/Controllers')
-rw-r--r--src/slskd/Shares/API/Controllers/SharesController.cs15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/slskd/Shares/API/Controllers/SharesController.cs b/src/slskd/Shares/API/Controllers/SharesController.cs
index 251f50b9..990d6143 100644
--- a/src/slskd/Shares/API/Controllers/SharesController.cs
+++ b/src/slskd/Shares/API/Controllers/SharesController.cs
@@ -38,13 +38,10 @@ namespace slskd.Shares.API
/// Initializes a new instance of the <see cref="SharesController"/> class.
/// </summary>
/// <param name="shareService"></param>
- /// <param name="applicationStateMonitor"></param>
public SharesController(
- IShareService shareService,
- IStateMonitor<State> applicationStateMonitor)
+ IShareService shareService)
{
Shares = shareService;
- ApplicationStateMonitor = applicationStateMonitor;
}
private IShareService Shares { get; }
@@ -181,15 +178,17 @@ namespace slskd.Shares.API
[Authorize]
[ProducesResponseType(204)]
[ProducesResponseType(409)]
- public IActionResult RescanSharesAsync()
+ public async Task<IActionResult> RescanSharesAsync()
{
- if (ApplicationStateMonitor.CurrentValue.Shares.Cache.Filling)
+ try
+ {
+ await Shares.StartScanAsync();
+ }
+ catch (ShareScanInProgressException)
{
return Conflict("A share scan is already in progress.");
}
- _ = Shares.StartScanAsync();
-
return Ok();
}
}