From c8c97202df9b7e25a1ee84d264f324960e1c548e Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 30 May 2022 16:15:29 -0500 Subject: remove app state monitor dependency --- src/slskd/Shares/API/Controllers/SharesController.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/slskd/Shares/API/Controllers/SharesController.cs') 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 class. /// /// - /// public SharesController( - IShareService shareService, - IStateMonitor 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 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(); } } -- cgit v1.2.3