From de9045d3f60ce27f2de103fa3e281464715c5407 Mon Sep 17 00:00:00 2001 From: Roger Far Date: Mon, 8 Jan 2024 19:51:32 -0700 Subject: [PATCH] Tweaked the downloader a bit to fix the memory issues. --- .../Models/Internal/DbSettings.cs | 4 ---- .../Downloaders/InternalDownloader.cs | 19 +++++-------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/server/RdtClient.Data/Models/Internal/DbSettings.cs b/server/RdtClient.Data/Models/Internal/DbSettings.cs index 68cae34..6359d01 100644 --- a/server/RdtClient.Data/Models/Internal/DbSettings.cs +++ b/server/RdtClient.Data/Models/Internal/DbSettings.cs @@ -95,10 +95,6 @@ public class DbSettingsDownloadClient [Description("Maximum download speed in Megabytes per second. When set to 0 unlimited speed is used.")] public Int32 MaxSpeed { get; set; } = 0; - [DisplayName("Parallel connections per download (only used for the Internal Downloader)")] - [Description("Maximum amount of parallel threads that are used to download a single file to your host. If set to 0 no parallel downloading will be done.")] - public Int32 ParallelCount { get; set; } = 0; - [DisplayName("Chunk Count")] [Description("Split the downloaded file in this amount of chunks. If left to 0, automatically deteremine the chunk size based on the file size.")] public Int32 ChunkCount { get; set; } = 0; diff --git a/server/RdtClient.Service/Services/Downloaders/InternalDownloader.cs b/server/RdtClient.Service/Services/Downloaders/InternalDownloader.cs index 084f6d4..30d547d 100644 --- a/server/RdtClient.Service/Services/Downloaders/InternalDownloader.cs +++ b/server/RdtClient.Service/Services/Downloaders/InternalDownloader.cs @@ -31,13 +31,12 @@ public class InternalDownloader : IDownloader // For all options, see https://github.com/bezzad/Downloader _downloadConfiguration = new DownloadConfiguration { - BufferBlockSize = 1024 * 8, MaxTryAgainOnFailover = 5, RangeDownload = false, - ClearPackageOnCompletionWithFailure = false, - MinimumSizeOfChunking = 1024, + ClearPackageOnCompletionWithFailure = true, ReserveStorageSpaceBeforeStartingDownload = false, - CheckDiskSizeBeforeDownload = true, + CheckDiskSizeBeforeDownload = false, + MaximumMemoryBufferBytes = 1024 * 1024 * 10, RequestConfiguration = { Accept = "*/*", @@ -122,7 +121,7 @@ public class InternalDownloader : IDownloader _ = Task.Run(StartTimer); - return null; + return Guid.NewGuid().ToString(); } public Task Cancel() @@ -146,13 +145,6 @@ public class InternalDownloader : IDownloader private void SetSettings() { - var settingDownloadParallelCount = Settings.Get.DownloadClient.ParallelCount; - - if (settingDownloadParallelCount <= 0) - { - settingDownloadParallelCount = 1; - } - var settingDownloadMaxSpeed = Settings.Get.DownloadClient.MaxSpeed; if (settingDownloadMaxSpeed <= 0) @@ -170,8 +162,7 @@ public class InternalDownloader : IDownloader } _downloadConfiguration.MaximumBytesPerSecond = settingDownloadMaxSpeed; - _downloadConfiguration.ParallelDownload = settingDownloadParallelCount > 1; - _downloadConfiguration.ParallelCount = settingDownloadParallelCount; + _downloadConfiguration.ParallelDownload = true; _downloadConfiguration.Timeout = settingDownloadTimeout; }