From a4f20fd3a42dfe32581ded4996cde8b4c983ce9f Mon Sep 17 00:00:00 2001 From: Cucumberrbob <128094686+Cucumberrbob@users.noreply.github.com> Date: Sun, 20 Apr 2025 12:00:21 +0100 Subject: [PATCH 1/2] fix: catch and handle errors when dequeuing torrent --- server/RdtClient.Service/Services/TorrentRunner.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/RdtClient.Service/Services/TorrentRunner.cs b/server/RdtClient.Service/Services/TorrentRunner.cs index 555e49f..ea828f9 100644 --- a/server/RdtClient.Service/Services/TorrentRunner.cs +++ b/server/RdtClient.Service/Services/TorrentRunner.cs @@ -333,7 +333,15 @@ public class TorrentRunner(ILogger logger, Torrents torrents, Dow foreach (var torrent in torrentsToAddToProvider.Take(dequeueCount)) { - await torrents.DequeueFromDebridQueue(torrent); + try + { + await torrents.DequeueFromDebridQueue(torrent); + } + catch (Exception ex) + { + await torrents.UpdateComplete(torrent.TorrentId, $"Could not add to provider: {ex.Message}", DateTimeOffset.Now, true); + logger.LogWarning(ex, "Could not dequeue torrent {torrentId}", torrent.TorrentId); + } } } From 5ba630ff52310c9660c4343137077f36176eae55 Mon Sep 17 00:00:00 2001 From: Cucumberrbob <128094686+Cucumberrbob@users.noreply.github.com> Date: Sun, 20 Apr 2025 12:00:47 +0100 Subject: [PATCH 2/2] fix: don't autodelete queued torrents --- server/RdtClient.Service/Services/Torrents.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/RdtClient.Service/Services/Torrents.cs b/server/RdtClient.Service/Services/Torrents.cs index 96ac155..94d12f2 100644 --- a/server/RdtClient.Service/Services/Torrents.cs +++ b/server/RdtClient.Service/Services/Torrents.cs @@ -523,7 +523,7 @@ public class Torrents( { var rdTorrent = rdTorrents.FirstOrDefault(m => m.Id == torrent.RdId); - if (rdTorrent == null && Settings.Get.Provider.AutoDelete) + if (rdTorrent == null && Settings.Get.Provider.AutoDelete && torrent.RdStatus != TorrentStatus.Queued) { await Delete(torrent.TorrentId, true, false, true); }