|
|
|
@ -2,8 +2,10 @@
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using NLog;
|
|
|
|
|
using NzbDrone.Common;
|
|
|
|
|
using NzbDrone.Core.DecisionEngine;
|
|
|
|
|
using NzbDrone.Core.Download.Pending;
|
|
|
|
|
using NzbDrone.Core.Parser.Model;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Download
|
|
|
|
|
{
|
|
|
|
@ -37,6 +39,9 @@ namespace NzbDrone.Core.Download
|
|
|
|
|
var grabbed = new List<DownloadDecision>();
|
|
|
|
|
var pending = new List<DownloadDecision>();
|
|
|
|
|
|
|
|
|
|
//Limits to 1 grab every 1 second to reduce rapid API hits
|
|
|
|
|
using (var rateGate = new RateGate(1, TimeSpan.FromSeconds(1)))
|
|
|
|
|
{
|
|
|
|
|
foreach (var report in prioritizedDecisions)
|
|
|
|
|
{
|
|
|
|
|
var remoteEpisode = report.RemoteEpisode;
|
|
|
|
@ -71,6 +76,7 @@ namespace NzbDrone.Core.Download
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
rateGate.WaitToProceed();
|
|
|
|
|
_downloadService.DownloadReport(remoteEpisode);
|
|
|
|
|
grabbed.Add(report);
|
|
|
|
|
}
|
|
|
|
@ -81,6 +87,7 @@ namespace NzbDrone.Core.Download
|
|
|
|
|
_logger.WarnException("Couldn't add report to download queue. " + remoteEpisode, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new ProcessedDecisions(grabbed, pending, decisions.Where(d => d.Rejected).ToList());
|
|
|
|
|
}
|
|
|
|
|