Fixed retrying of torrents.

This commit is contained in:
Roger Far 2021-10-11 13:53:05 -06:00
parent d6327e44b6
commit 399456c815
2 changed files with 4 additions and 6 deletions

View file

@ -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

View file

@ -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);
}
}
}