Fixed retrying of torrents.
This commit is contained in:
parent
d6327e44b6
commit
399456c815
2 changed files with 4 additions and 6 deletions
|
|
@ -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");
|
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);
|
await _torrents.RetryTorrent(download.TorrentId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -386,6 +386,8 @@ namespace RdtClient.Service.Services
|
||||||
{
|
{
|
||||||
var torrent = await _torrentData.GetById(torrentId);
|
var torrent = await _torrentData.GetById(torrentId);
|
||||||
|
|
||||||
|
var newRetryCount = torrent.RetryCount + 1;
|
||||||
|
|
||||||
foreach (var download in torrent.Downloads)
|
foreach (var download in torrent.Downloads)
|
||||||
{
|
{
|
||||||
while (TorrentRunner.ActiveDownloadClients.TryGetValue(download.DownloadId, out var downloadClient))
|
while (TorrentRunner.ActiveDownloadClients.TryGetValue(download.DownloadId, out var downloadClient))
|
||||||
|
|
@ -429,6 +431,8 @@ namespace RdtClient.Service.Services
|
||||||
torrent.DownloadMinSize,
|
torrent.DownloadMinSize,
|
||||||
torrent.DownloadManualFiles);
|
torrent.DownloadManualFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await _torrentData.UpdateRetryCount(torrent.TorrentId, newRetryCount);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
@ -635,10 +639,5 @@ namespace RdtClient.Service.Services
|
||||||
await _torrentData.UpdateRdData(torrent);
|
await _torrentData.UpdateRdData(torrent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateRetryCount(Guid torrentId, Int32 retryCount)
|
|
||||||
{
|
|
||||||
await _torrentData.UpdateRetryCount(torrentId, retryCount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue