diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-10-01 17:35:11 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-01 17:35:11 -0500 |
| commit | 00f2bfe1b1a0ab8a1162f6c17bc8b98f81dfedd2 (patch) | |
| tree | 0348bef8843ff8d843f57841ce0c064d0e804658 /src/slskd/Application.cs | |
| parent | 92d48858aa02f4900b7fe695f2c23fa3e86c8d74 (diff) | |
| parent | 0da5a0155e3396f108a4a43e7670cba3fffc523a (diff) | |
| download | slskd-00f2bfe1b1a0ab8a1162f6c17bc8b98f81dfedd2.tar.gz | |
Merge pull request #669 from slskd/share-refactor
Refactor share logic
Diffstat (limited to 'src/slskd/Application.cs')
| -rw-r--r-- | src/slskd/Application.cs | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index f517850b..57f968ec 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -371,21 +371,15 @@ namespace slskd _ = CheckVersionAsync(); } - // try to load the share cache from disk. - // if not successful, the file is missing one or more tables, or is not present at all - if (!await Shares.TryLoadFromDiskAsync()) + if (!OptionsAtStartup.Flags.NoShareScan) { - Log.Warning("Unable to load share cache from disk. A share scan is required."); - - State.SetValue(state => state with { Shares = state.Shares with { ScanPending = true } }); - - if (OptionsAtStartup.Flags.NoShareScan) + try { - Log.Warning("Not scanning shares; 'no-share-scan' option is enabled. Search and browse results will remain disabled until a manual scan is completed."); + await Shares.InitializeAsync(forceRescan: OptionsAtStartup.Flags.ForceShareScan); } - else + catch (Exception) { - await Shares.ScanAsync(); + Log.Error("Failed to initialize shares. Sharing is disabled"); } } |
