diff --git a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs index 9dbd60a8f..514bcbee8 100644 --- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs @@ -239,17 +239,31 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd 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(); + 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 GetCategories(SabnzbdConfig config) diff --git a/src/NzbDrone.Core/Download/DownloadTrackingService.cs b/src/NzbDrone.Core/Download/DownloadTrackingService.cs index 557c61cb5..3dc255219 100644 --- a/src/NzbDrone.Core/Download/DownloadTrackingService.cs +++ b/src/NzbDrone.Core/Download/DownloadTrackingService.cs @@ -147,7 +147,7 @@ namespace NzbDrone.Core.Download 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 @@ namespace NzbDrone.Core.Download _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());