diff options
| author | JP Dillingham <jp@dillingham.me> | 2024-05-11 19:27:45 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2024-05-11 19:27:45 -0500 |
| commit | e4c20ae1a67dc6d03db6f3a6f6e8eac1c612d3f3 (patch) | |
| tree | d015abcca738ea9f828c50ef4af680c27e6c39bd /src | |
| parent | 45907e3a8547bdfe59e6e829aec91af934c5367e (diff) | |
| download | slskd-e4c20ae1a67dc6d03db6f3a6f6e8eac1c612d3f3.tar.gz | |
make FileService singleton
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Files/FileService.cs | 10 | ||||
| -rw-r--r-- | src/slskd/Program.cs | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/slskd/Files/FileService.cs b/src/slskd/Files/FileService.cs index c3da7621..18bf72d1 100644 --- a/src/slskd/Files/FileService.cs +++ b/src/slskd/Files/FileService.cs @@ -36,19 +36,19 @@ namespace slskd.Files /// Initializes a new instance of the <see cref="FileService"/> class. /// </summary> public FileService( - IOptionsSnapshot<Options> optionsSnapshot) + IOptionsMonitor<Options> optionsMonitor) { - OptionsSnapshot = optionsSnapshot; + OptionsMonitor = optionsMonitor; } private IEnumerable<string> AllowedDirectories => new[] { - Path.GetFullPath(OptionsSnapshot.Value.Directories.Downloads), - Path.GetFullPath(OptionsSnapshot.Value.Directories.Incomplete), + Path.GetFullPath(OptionsMonitor.CurrentValue.Directories.Downloads), + Path.GetFullPath(OptionsMonitor.CurrentValue.Directories.Incomplete), }; private ILogger Log { get; } = Serilog.Log.ForContext<FileService>(); - private IOptionsSnapshot<Options> OptionsSnapshot { get; } + private IOptionsMonitor<Options> OptionsMonitor { get; } /// <summary> /// Deletes the specified <paramref name="directories"/>. diff --git a/src/slskd/Program.cs b/src/slskd/Program.cs index 545a80ab..27cbfc6f 100644 --- a/src/slskd/Program.cs +++ b/src/slskd/Program.cs @@ -590,7 +590,7 @@ namespace slskd services.AddSingleton<ITransferService, TransferService>(); services.AddSingleton<IDownloadService, DownloadService>(); services.AddSingleton<IUploadService, UploadService>(); - services.AddTransient<FileService>(); + services.AddSingleton<FileService>(); services.AddSingleton<IRelayService, RelayService>(); |
