Tweaked the downloader a bit to fix the memory issues.
This commit is contained in:
parent
2e03ad35f4
commit
de9045d3f6
2 changed files with 5 additions and 18 deletions
|
|
@ -95,10 +95,6 @@ public class DbSettingsDownloadClient
|
||||||
[Description("Maximum download speed in Megabytes per second. When set to 0 unlimited speed is used.")]
|
[Description("Maximum download speed in Megabytes per second. When set to 0 unlimited speed is used.")]
|
||||||
public Int32 MaxSpeed { get; set; } = 0;
|
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")]
|
[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.")]
|
[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;
|
public Int32 ChunkCount { get; set; } = 0;
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,12 @@ public class InternalDownloader : IDownloader
|
||||||
// For all options, see https://github.com/bezzad/Downloader
|
// For all options, see https://github.com/bezzad/Downloader
|
||||||
_downloadConfiguration = new DownloadConfiguration
|
_downloadConfiguration = new DownloadConfiguration
|
||||||
{
|
{
|
||||||
BufferBlockSize = 1024 * 8,
|
|
||||||
MaxTryAgainOnFailover = 5,
|
MaxTryAgainOnFailover = 5,
|
||||||
RangeDownload = false,
|
RangeDownload = false,
|
||||||
ClearPackageOnCompletionWithFailure = false,
|
ClearPackageOnCompletionWithFailure = true,
|
||||||
MinimumSizeOfChunking = 1024,
|
|
||||||
ReserveStorageSpaceBeforeStartingDownload = false,
|
ReserveStorageSpaceBeforeStartingDownload = false,
|
||||||
CheckDiskSizeBeforeDownload = true,
|
CheckDiskSizeBeforeDownload = false,
|
||||||
|
MaximumMemoryBufferBytes = 1024 * 1024 * 10,
|
||||||
RequestConfiguration =
|
RequestConfiguration =
|
||||||
{
|
{
|
||||||
Accept = "*/*",
|
Accept = "*/*",
|
||||||
|
|
@ -122,7 +121,7 @@ public class InternalDownloader : IDownloader
|
||||||
|
|
||||||
_ = Task.Run(StartTimer);
|
_ = Task.Run(StartTimer);
|
||||||
|
|
||||||
return null;
|
return Guid.NewGuid().ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task Cancel()
|
public Task Cancel()
|
||||||
|
|
@ -146,13 +145,6 @@ public class InternalDownloader : IDownloader
|
||||||
|
|
||||||
private void SetSettings()
|
private void SetSettings()
|
||||||
{
|
{
|
||||||
var settingDownloadParallelCount = Settings.Get.DownloadClient.ParallelCount;
|
|
||||||
|
|
||||||
if (settingDownloadParallelCount <= 0)
|
|
||||||
{
|
|
||||||
settingDownloadParallelCount = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
var settingDownloadMaxSpeed = Settings.Get.DownloadClient.MaxSpeed;
|
var settingDownloadMaxSpeed = Settings.Get.DownloadClient.MaxSpeed;
|
||||||
|
|
||||||
if (settingDownloadMaxSpeed <= 0)
|
if (settingDownloadMaxSpeed <= 0)
|
||||||
|
|
@ -170,8 +162,7 @@ public class InternalDownloader : IDownloader
|
||||||
}
|
}
|
||||||
|
|
||||||
_downloadConfiguration.MaximumBytesPerSecond = settingDownloadMaxSpeed;
|
_downloadConfiguration.MaximumBytesPerSecond = settingDownloadMaxSpeed;
|
||||||
_downloadConfiguration.ParallelDownload = settingDownloadParallelCount > 1;
|
_downloadConfiguration.ParallelDownload = true;
|
||||||
_downloadConfiguration.ParallelCount = settingDownloadParallelCount;
|
|
||||||
_downloadConfiguration.Timeout = settingDownloadTimeout;
|
_downloadConfiguration.Timeout = settingDownloadTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue