Fixed: Some timing issues in Sabnzbd RetryDownload logic.

pull/6/head
Taloth Saldono 10 years ago
parent 174a209c66
commit e867548ec3

@ -239,17 +239,31 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
if (history.Count() != 1) if (history.Count() != 1)
{ {
_logger.Debug("History item missing. Couldn't get the new nzoid.");
return id; return id;
} }
var queue = GetQueue().Where(v => v.Category == history.First().Category && v.Title == history.First().Title).ToList(); var queue = new List<DownloadClientItem>();
for (int i = 0; i < 3; i++)
{
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() != 1) if (queue.Count() > 2)
{ {
_logger.Debug("Multiple items with the correct title. Couldn't get the new nzoid.");
return id; return id;
} }
return queue.First().DownloadClientId; System.Threading.Thread.Sleep(500);
}
_logger.Debug("No items with the correct title. Couldn't get the new nzoid.");
return id;
} }
protected IEnumerable<SabnzbdCategory> GetCategories(SabnzbdConfig config) protected IEnumerable<SabnzbdCategory> GetCategories(SabnzbdConfig config)

@ -147,7 +147,7 @@ namespace NzbDrone.Core.Download
State = TrackedDownloadState.Unknown 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; stateChanged = true;
} }
@ -167,7 +167,7 @@ namespace NzbDrone.Core.Download
_logger.Debug("Item removed from download client by user: {0}: {1}", downloadItem.TrackingId, downloadItem.DownloadItem.Title); _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()); _trackedDownloadCache.Set("tracked", newTrackedDownloads.Values.ToArray());

Loading…
Cancel
Save