Added option to configure the buffersize for the internal downloader.

This commit is contained in:
Roger Far 2024-04-07 00:14:48 -06:00
parent c44ed2a51c
commit d6e549bb67
3 changed files with 16 additions and 0 deletions

View file

@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.0.65] - 2024-04-07
### Added
- Added option to configure the buffersize for the internal downloader.
## [2.0.64] - 2024-04-06
### Added
- Add log level Verbose and add logging for the internal downloader, only works when both log levels are set to Verbose.

View file

@ -103,6 +103,10 @@ public class DbSettingsDownloadClient
[Description("Split the downloaded file in this amount of chunks.")]
public Int32 ChunkCount { get; set; } = 8;
[DisplayName("Buffer Size")]
[Description("Buffersize in bytes for the internal downloader, used to read data and write it to disk.")]
public Int32 BufferSize { get; set; } = 1024 * 1024;
[DisplayName("Connection Timeout (only used for the Internal Downloader)")]
[Description("Timeout in milliseconds before the downloader times out.")]
public Int32 Timeout { get; set; } = 5000;

View file

@ -118,6 +118,13 @@ public class InternalDownloader : IDownloader
private void SetSettings()
{
var settingBufferSize = Settings.Get.DownloadClient.BufferSize;
if (settingBufferSize <= 4096)
{
settingBufferSize = 4096;
}
var settingDownloadParallelCount = Settings.Get.DownloadClient.ParallelCount;
if (settingDownloadParallelCount <= 0)
@ -141,6 +148,7 @@ public class InternalDownloader : IDownloader
settingDownloadTimeout = 1000;
}
_downloadConfiguration.BufferSize = settingBufferSize;
_downloadConfiguration.LogLevel = (Int32)Settings.Get.DownloadClient.LogLevel;
_downloadConfiguration.Parallel = settingDownloadParallelCount;
_downloadConfiguration.MaximumBytesPerSecond = settingDownloadMaxSpeed;