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] 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); + } } }