aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-11-21 18:47:30 -0600
committerJP Dillingham <jp@dillingham.me>2022-11-21 18:47:30 -0600
commit26819a1d01079305d2a8ee8b010217eac6890de7 (patch)
treeee68449321cf3abfe49ed474c23e6c312b25ce8c /src
parent347eb4ed454c0d30996fbd6c46647e9282976844 (diff)
downloadslskd-26819a1d01079305d2a8ee8b010217eac6890de7.tar.gz
don't set ready flag until post-scan things are finished
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Shares/ShareService.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/slskd/Shares/ShareService.cs b/src/slskd/Shares/ShareService.cs
index 3101cede..7051fda3 100644
--- a/src/slskd/Shares/ShareService.cs
+++ b/src/slskd/Shares/ShareService.cs
@@ -70,7 +70,6 @@ namespace slskd.Shares
Scanning = current.Filling,
Faulted = current.Faulted,
Cancelled = current.Cancelled,
- Ready = current.Filled,
ScanProgress = current.FillProgress,
Directories = current.Directories,
Files = current.Files,
@@ -319,6 +318,8 @@ namespace slskd.Shares
/// <exception cref="ShareScanInProgressException">Thrown when a scan is already in progress.</exception>
public async Task ScanAsync()
{
+ State.SetValue(state => state with { Ready = false });
+
await Scanner.ScanAsync(Local.Host.Shares, OptionsMonitor.CurrentValue.Shares, Local.Repository);
Log.Debug("Backing up shared file cache database...");
@@ -327,12 +328,13 @@ namespace slskd.Shares
Log.Debug("Recomputing share statistics...");
ComputeShareStatistics();
- Log.Debug("Share statistics updated");
+ Log.Debug("Share statistics updated: {Shares}", Local.Host.Shares.ToJson());
State.SetValue(state => state with
{
Directories = Hosts.SelectMany(host => host.Shares).Sum(share => share.Directories),
Files = Hosts.SelectMany(host => host.Shares).Sum(share => share.Files),
+ Ready = true,
});
}
@@ -354,6 +356,9 @@ namespace slskd.Shares
{
Log.Information("Initializing shares");
+ // _probably_ redundant, but to be safe
+ State.SetValue(state => state with { Ready = false });
+
try
{
if (forceRescan)