aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Application.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-08-22 17:46:21 -0500
committerGitHub <noreply@github.com>2022-08-22 17:46:21 -0500
commit43b5411cbd8d85a338acc0033cfade3c509bf1f4 (patch)
treecd57348d6ef64036bb8d1f2603118eec07e07c0c /src/slskd/Application.cs
parent686717cfaafdcfddae9733f2ebdae178aa3fa8c0 (diff)
parente319e32ef9ba22c85a85d6872ed7bdbbce04747d (diff)
downloadslskd-43b5411cbd8d85a338acc0033cfade3c509bf1f4.tar.gz
Merge pull request #611 from slskd/share-ex
Include Exception when formatting logs
Diffstat (limited to 'src/slskd/Application.cs')
-rw-r--r--src/slskd/Application.cs26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs
index f9cb95d2..5a56e110 100644
--- a/src/slskd/Application.cs
+++ b/src/slskd/Application.cs
@@ -927,23 +927,15 @@ namespace slskd
if (!previous.Scanning && current.Scanning)
{
+ // the scan is starting
SharesRefreshStarted = DateTime.UtcNow;
State.SetValue(s => s with { Shares = current });
Log.Information("Scanning shares");
}
-
- var lastProgress = Math.Round(previous.ScanProgress * 100);
- var currentProgress = Math.Round(current.ScanProgress * 100);
-
- if (lastProgress != currentProgress && Math.Round(currentProgress, 0) % 10 == 0)
- {
- State.SetValue(s => s with { Shares = current });
- Log.Information("Scanned {Percent}% of shared directories. Found {Files} files so far.", currentProgress, current.Files);
- }
-
- if (previous.Scanning && !current.Scanning)
+ else if (previous.Scanning && !current.Scanning)
{
+ // the scan is finishing
State.SetValue(s => s with { Shares = current });
if (current.Faulted)
@@ -967,6 +959,18 @@ namespace slskd
}
}
}
+ else
+ {
+ // the scan is neither starting nor finishing; progress update
+ var lastProgress = Math.Round(previous.ScanProgress * 100);
+ var currentProgress = Math.Round(current.ScanProgress * 100);
+
+ if (lastProgress != currentProgress && Math.Round(currentProgress, 0) % 10d == 0)
+ {
+ State.SetValue(s => s with { Shares = current });
+ Log.Information("Scanned {Percent}% () of shared directories. Found {Files} files so far.", currentProgress, current.Files);
+ }
+ }
}
private void State_OnChange((State Previous, State Current) state)