diff --git a/server/RdtClient.Service/Services/TorrentRunner.cs b/server/RdtClient.Service/Services/TorrentRunner.cs index 2765d8a..b9b5f75 100644 --- a/server/RdtClient.Service/Services/TorrentRunner.cs +++ b/server/RdtClient.Service/Services/TorrentRunner.cs @@ -115,7 +115,6 @@ namespace RdtClient.Service.Services { Log.Debug($"Processing active download {downloadId}: error {downloadClient.Error}, download retry count {download.RetryCount}/{DownloadRetryCount}, torrent retry count {download.Torrent.RetryCount}/{TorrentRetryCount}, retrying torrent"); - await _torrents.UpdateRetryCount(download.TorrentId, download.Torrent.RetryCount + 1); await _torrents.RetryTorrent(download.TorrentId); } else diff --git a/server/RdtClient.Service/Services/Torrents.cs b/server/RdtClient.Service/Services/Torrents.cs index 3bd457b..c470f98 100644 --- a/server/RdtClient.Service/Services/Torrents.cs +++ b/server/RdtClient.Service/Services/Torrents.cs @@ -386,6 +386,8 @@ namespace RdtClient.Service.Services { var torrent = await _torrentData.GetById(torrentId); + var newRetryCount = torrent.RetryCount + 1; + foreach (var download in torrent.Downloads) { while (TorrentRunner.ActiveDownloadClients.TryGetValue(download.DownloadId, out var downloadClient)) @@ -429,6 +431,8 @@ namespace RdtClient.Service.Services torrent.DownloadMinSize, torrent.DownloadManualFiles); } + + await _torrentData.UpdateRetryCount(torrent.TorrentId, newRetryCount); } finally { @@ -635,10 +639,5 @@ namespace RdtClient.Service.Services await _torrentData.UpdateRdData(torrent); } } - - public async Task UpdateRetryCount(Guid torrentId, Int32 retryCount) - { - await _torrentData.UpdateRetryCount(torrentId, retryCount); - } } }