From 9f4a34b20e13499d17a3debdd7dbf6913ceae5d1 Mon Sep 17 00:00:00 2001 From: Roger Versluis Date: Wed, 15 Nov 2023 18:59:44 -0700 Subject: [PATCH] Add missing retry count to the internal downloader. --- CHANGELOG.md | 4 ++++ client/src/app/navbar/navbar.component.html | 2 +- package.json | 2 +- .../RdtClient.Service/RdtClient.Service.csproj | 2 +- .../Services/Downloaders/InternalDownloader.cs | 16 ++++++++++------ server/RdtClient.Web/RdtClient.Web.csproj | 2 +- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5841d62..dea18fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/client/src/app/navbar/navbar.component.html b/client/src/app/navbar/navbar.component.html index f300e1f..1a18b74 100644 --- a/client/src/app/navbar/navbar.component.html +++ b/client/src/app/navbar/navbar.component.html @@ -55,7 +55,7 @@ Profile Logout - Version 2.0.45 + Version 2.0.46 diff --git a/package.json b/package.json index af1334a..7fd9e06 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/server/RdtClient.Service/RdtClient.Service.csproj b/server/RdtClient.Service/RdtClient.Service.csproj index a580244..c4f25b3 100644 --- a/server/RdtClient.Service/RdtClient.Service.csproj +++ b/server/RdtClient.Service/RdtClient.Service.csproj @@ -11,7 +11,7 @@ - + diff --git a/server/RdtClient.Service/Services/Downloaders/InternalDownloader.cs b/server/RdtClient.Service/Services/Downloaders/InternalDownloader.cs index 2699efb..0b95a07 100644 --- a/server/RdtClient.Service/Services/Downloaders/InternalDownloader.cs +++ b/server/RdtClient.Service/Services/Downloaders/InternalDownloader.cs @@ -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(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() diff --git a/server/RdtClient.Web/RdtClient.Web.csproj b/server/RdtClient.Web/RdtClient.Web.csproj index eaa2c3d..c25108b 100644 --- a/server/RdtClient.Web/RdtClient.Web.csproj +++ b/server/RdtClient.Web/RdtClient.Web.csproj @@ -4,7 +4,7 @@ net8.0 Exe 94c24cba-f03f-4453-a671-3640b517c573 - 2.0.45 + 2.0.46 enable enable latest