aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Shares/API/Controllers/SharesController.cs
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2022-05-30 16:15:29 -0500
committerJP Dillingham <jpdillingham@gmail.com>2022-05-30 16:15:29 -0500
commitc8c97202df9b7e25a1ee84d264f324960e1c548e (patch)
treebecf0b4f5b4d07076bb5c7bc5d9557ebd2a4052f /src/slskd/Shares/API/Controllers/SharesController.cs
parenta1b481cfbb0483e54266f2dfeed80ceb070d0f63 (diff)
downloadslskd-c8c97202df9b7e25a1ee84d264f324960e1c548e.tar.gz
remove app state monitor dependency
Diffstat (limited to 'src/slskd/Shares/API/Controllers/SharesController.cs')
-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();
}
}