mirror of
https://github.com/lidarr/Lidarr
synced 2025-01-30 10:51:42 +00:00
Fixed: Some timing issues in Sabnzbd RetryDownload logic.
This commit is contained in:
parent
174a209c66
commit
e867548ec3
2 changed files with 21 additions and 7 deletions
|
@ -239,17 +239,31 @@ public override String RetryDownload(String id)
|
|||
|
||||
if (history.Count() != 1)
|
||||
{
|
||||
_logger.Debug("History item missing. Couldn't get the new nzoid.");
|
||||
return id;
|
||||
}
|
||||
|
||||
var queue = GetQueue().Where(v => v.Category == history.First().Category && v.Title == history.First().Title).ToList();
|
||||
|
||||
if (queue.Count() != 1)
|
||||
var queue = new List<DownloadClientItem>();
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
return id;
|
||||
queue = GetQueue().Where(v => v.Category == history.First().Category && v.Title == history.First().Title).ToList();
|
||||
|
||||
if (queue.Count() == 1)
|
||||
{
|
||||
return queue.First().DownloadClientId;
|
||||
}
|
||||
|
||||
if (queue.Count() > 2)
|
||||
{
|
||||
_logger.Debug("Multiple items with the correct title. Couldn't get the new nzoid.");
|
||||
return id;
|
||||
}
|
||||
|
||||
System.Threading.Thread.Sleep(500);
|
||||
}
|
||||
|
||||
return queue.First().DownloadClientId;
|
||||
_logger.Debug("No items with the correct title. Couldn't get the new nzoid.");
|
||||
return id;
|
||||
}
|
||||
|
||||
protected IEnumerable<SabnzbdCategory> GetCategories(SabnzbdConfig config)
|
||||
|
|
|
@ -147,7 +147,7 @@ private Boolean UpdateTrackedDownloads()
|
|||
State = TrackedDownloadState.Unknown
|
||||
};
|
||||
|
||||
_logger.Trace("Started tracking download from history: {0}: {1}", trackedDownload.TrackingId, downloadItem.Title);
|
||||
_logger.Debug("Started tracking download from history: {0}: {1}", trackedDownload.TrackingId, downloadItem.Title);
|
||||
stateChanged = true;
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ private Boolean UpdateTrackedDownloads()
|
|||
_logger.Debug("Item removed from download client by user: {0}: {1}", downloadItem.TrackingId, downloadItem.DownloadItem.Title);
|
||||
}
|
||||
|
||||
_logger.Trace("Stopped tracking download: {0}: {1}", downloadItem.TrackingId, downloadItem.DownloadItem.Title);
|
||||
_logger.Debug("Stopped tracking download: {0}: {1}", downloadItem.TrackingId, downloadItem.DownloadItem.Title);
|
||||
}
|
||||
|
||||
_trackedDownloadCache.Set("tracked", newTrackedDownloads.Values.ToArray());
|
||||
|
|
Loading…
Reference in a new issue