Add missing retry count to the internal downloader.
Some checks failed
Docker Image CI / build (push) Has been cancelled

This commit is contained in:
Roger Versluis 2023-11-15 18:59:44 -07:00
parent cf4527b6c9
commit 9f4a34b20e
6 changed files with 18 additions and 10 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.46] - 2023-11-15
### Changed
- Fix in internal downloader.
## [2.0.45] - 2023-11-15
### Changed
- Optimizations to the internal downloader.

View file

@ -55,7 +55,7 @@
<a class="navbar-item" routerLink="profile"> Profile </a>
<a class="navbar-item" (click)="logout()"> Logout </a>
<hr class="navbar-divider" />
<a href="https://github.com/rogerfar/rdt-client" target="_blank" class="navbar-item">Version 2.0.45</a>
<a href="https://github.com/rogerfar/rdt-client" target="_blank" class="navbar-item">Version 2.0.46</a>
</div>
</div>
</div>

View file

@ -1,6 +1,6 @@
{
"name": "rdt-client",
"version": "2.0.45",
"version": "2.0.46",
"description": "This is a web interface to manage your torrents on Real-Debrid.",
"main": "index.js",
"dependencies": {

View file

@ -11,7 +11,7 @@
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="AllDebrid.NET" Version="1.0.12" />
<PackageReference Include="Aria2.NET" Version="1.0.5" />
<PackageReference Include="Downloader.NET" Version="1.0.6" />
<PackageReference Include="Downloader.NET" Version="1.0.8" />
<PackageReference Include="MonoTorrent" Version="2.0.7" />
<PackageReference Include="Premiumize.NET" Version="1.0.4" />
<PackageReference Include="RD.NET" Version="2.1.4" />

View file

@ -1,4 +1,5 @@
using DownloaderNET;
using System.Diagnostics;
using DownloaderNET;
using Serilog;
namespace RdtClient.Service.Services.Downloaders;
@ -33,7 +34,9 @@ public class InternalDownloader : IDownloader
_downloadService = new Downloader(_uri, _filePath, _downloadConfiguration);
_downloadService.OnProgress += args =>
_downloadService.OnLog += message => Debug.WriteLine(message.Message);
_downloadService.OnProgress += (chunks, _) =>
{
if (DownloadProgress == null)
{
@ -43,9 +46,9 @@ public class InternalDownloader : IDownloader
DownloadProgress.Invoke(this,
new DownloadProgressEventArgs
{
Speed = (Int64) args.Sum(m => m.Speed),
BytesDone = args.Sum(m => m.DownloadBytes),
BytesTotal = args.Sum(m => m.LengthBytes)
Speed = (Int64)chunks.Where(m => m.IsActive).Sum(m => m.Speed),
BytesDone = chunks.Sum(m => m.DownloadBytes),
BytesTotal = chunks.Sum(m => m.LengthBytes)
});
};
@ -67,7 +70,7 @@ public class InternalDownloader : IDownloader
{
_logger.Debug($"Starting download of {_uri}, writing to path: {_filePath}");
_downloadService.Download(_cancellationToken.Token);
Task.Run(async () => await _downloadService.Download(_cancellationToken.Token));
Task.Run(StartTimer);
return Task.FromResult<String?>(null);
@ -120,6 +123,7 @@ public class InternalDownloader : IDownloader
_downloadConfiguration.Parallel = settingDownloadParallelCount;
_downloadConfiguration.MaximumBytesPerSecond = settingDownloadMaxSpeed;
_downloadConfiguration.Timeout = settingDownloadTimeout;
_downloadConfiguration.RetryCount = 5;
}
private async Task StartTimer()

View file

@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
<UserSecretsId>94c24cba-f03f-4453-a671-3640b517c573</UserSecretsId>
<Version>2.0.45</Version>
<Version>2.0.46</Version>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>