diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-09-11 18:13:24 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-11 18:13:24 -0500 |
| commit | e7b57da3dad5dacb6dbbc59c1464950eb170b0b4 (patch) | |
| tree | 951f5f3531e3d69c99c9fd202d4467b4ff1d46ad /src/slskd/Shares/ShareService.cs | |
| parent | 3d657ed87cfdab4089c72d9e6532d9b2cc83aa4e (diff) | |
| parent | a596dfe252ef53e41b91ec6773aec93307c41f1e (diff) | |
| download | slskd-e7b57da3dad5dacb6dbbc59c1464950eb170b0b4.tar.gz | |
Merge pull request #641 from slskd/in-memory
Refactor share options, add option to allow users to select between on-disk and in-memory share caching
Diffstat (limited to 'src/slskd/Shares/ShareService.cs')
| -rw-r--r-- | src/slskd/Shares/ShareService.cs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/slskd/Shares/ShareService.cs b/src/slskd/Shares/ShareService.cs index 316e6b2f..dd808360 100644 --- a/src/slskd/Shares/ShareService.cs +++ b/src/slskd/Shares/ShareService.cs @@ -41,7 +41,7 @@ namespace slskd.Shares IOptionsMonitor<Options> optionsMonitor, ISharedFileCache sharedFileCache = null) { - Cache = sharedFileCache ?? new SharedFileCache(); + Cache = sharedFileCache ?? new SharedFileCache(storageMode: optionsMonitor.CurrentValue.Shares.Cache.StorageMode.ToEnum<StorageMode>()); Cache.StateMonitor.OnChange(cacheState => { var (previous, current) = cacheState; @@ -180,21 +180,21 @@ namespace slskd.Shares try { - var optionsHash = Compute.Sha1Hash(string.Join(';', options.Directories.Shared)); + var optionsHash = Compute.Sha1Hash(string.Join(';', options.Shares.Directories)); if (optionsHash == LastOptionsHash) { return; } - var shares = options.Directories.Shared + var shares = options.Shares.Directories .Select(share => share.TrimEnd('/', '\\')) .ToHashSet() // remove duplicates .Select(share => new Share(share)) // convert to Shares .OrderByDescending(share => share.LocalPath.Length) // process subdirectories first. this allows them to be aliased separately from their parent .ToList(); - var regexes = options.Filters.Share + var regexes = options.Shares.Filters .Select(filter => new Regex(filter, RegexOptions.Compiled)) .ToList(); |
