Tweaked the downloader a bit to fix the memory issues.

This commit is contained in:
Roger Far 2024-01-08 19:51:32 -07:00
parent 2e03ad35f4
commit de9045d3f6
2 changed files with 5 additions and 18 deletions

View file

@ -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;

View file

@ -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;
}