Merge pull request #755 from Cucumberrbob/perf/providerupdater-dont-update-when-all-rdfinished
`ProviderUpdater`: don't run if all torrents finished and `AutoImport == false`
This commit is contained in:
commit
3d4e656121
1 changed files with 3 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using RdtClient.Data.Enums;
|
||||||
using RdtClient.Service.Services;
|
using RdtClient.Service.Services;
|
||||||
|
|
||||||
namespace RdtClient.Service.BackgroundServices;
|
namespace RdtClient.Service.BackgroundServices;
|
||||||
|
|
@ -26,8 +27,8 @@ public class ProviderUpdater(ILogger<TaskRunner> logger, IServiceProvider servic
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var torrents = await torrentService.Get();
|
var torrents = await torrentService.Get();
|
||||||
|
|
||||||
if (_nextUpdate < DateTime.UtcNow && ((torrents.Count > 0 && !Settings.Get.Provider.AutoImport) || Settings.Get.Provider.AutoImport))
|
if (_nextUpdate < DateTime.UtcNow && (Settings.Get.Provider.AutoImport || torrents.Any(t => t.RdStatus != TorrentStatus.Finished)))
|
||||||
{
|
{
|
||||||
logger.LogDebug($"Updating torrent info from debrid provider");
|
logger.LogDebug($"Updating torrent info from debrid provider");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue