Fixed performance issues with the QueueModule and limited the number of items the Download Client will fetch as history.

pull/2/head
Taloth Saldono 11 years ago
parent c6e33bc463
commit 1b96a43037

@ -2,13 +2,15 @@
using NzbDrone.Api.REST;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv;
using NzbDrone.Api.Series;
using NzbDrone.Api.Episodes;
namespace NzbDrone.Api.Queue
{
public class QueueResource : RestResource
{
public Core.Tv.Series Series { get; set; }
public Episode Episode { get; set; }
public SeriesResource Series { get; set; }
public EpisodeResource Episode { get; set; }
public QualityModel Quality { get; set; }
public Decimal Size { get; set; }
public String Title { get; set; }

@ -10,6 +10,7 @@ using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Download;
using NzbDrone.Core.Configuration;
namespace NzbDrone.Core.Test.Download.DownloadClientTests
{
@ -22,6 +23,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
[SetUp]
public void SetupBase()
{
Mocker.GetMock<IConfigService>()
.SetupGet(s => s.DownloadClientHistoryLimit)
.Returns(30);
Mocker.GetMock<IParsingService>()
.Setup(s => s.Map(It.IsAny<ParsedEpisodeInfo>(), It.IsAny<int>(), null))
.Returns(CreateRemoteEpisode());

@ -205,6 +205,13 @@ namespace NzbDrone.Core.Configuration
set { SetValue("DownloadedEpisodesScanInterval", value); }
}
public Int32 DownloadClientHistoryLimit
{
get { return GetValueInt("DownloadClientHistoryLimit", 30); }
set { SetValue("DownloadClientHistoryLimit", value); }
}
public Boolean SkipFreeSpaceCheckWhenImporting
{
get { return GetValueBoolean("SkipFreeSpaceCheckWhenImporting", false); }

@ -17,6 +17,7 @@ namespace NzbDrone.Core.Configuration
String DownloadedEpisodesFolder { get; set; }
String DownloadClientWorkingFolders { get; set; }
Int32 DownloadedEpisodesScanInterval { get; set; }
Int32 DownloadClientHistoryLimit { get; set; }
//Completed/Failed Download Handling (Download client)
Boolean EnableCompletedDownloadHandling { get; set; }

@ -4,6 +4,7 @@ using System.Linq;
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Parser;
@ -18,10 +19,11 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
private readonly IHttpProvider _httpProvider;
public Nzbget(INzbgetProxy proxy,
IConfigService configService,
IParsingService parsingService,
IHttpProvider httpProvider,
Logger logger)
: base(parsingService, logger)
: base(configService, parsingService, logger)
{
_proxy = proxy;
_httpProvider = httpProvider;
@ -139,7 +141,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
try
{
history = _proxy.GetHistory(Settings);
history = _proxy.GetHistory(Settings).Take(_configService.DownloadClientHistoryLimit).ToList();
}
catch (DownloadClientException ex)
{

@ -17,20 +17,18 @@ namespace NzbDrone.Core.Download.Clients.Pneumatic
{
public class Pneumatic : DownloadClientBase<PneumaticSettings>, IExecute<TestPneumaticCommand>
{
private readonly IConfigService _configService;
private readonly IHttpProvider _httpProvider;
private readonly IDiskProvider _diskProvider;
private static readonly Logger logger = NzbDroneLogger.GetLogger();
public Pneumatic(IConfigService configService,
IHttpProvider httpProvider,
public Pneumatic(IHttpProvider httpProvider,
IDiskProvider diskProvider,
IConfigService configService,
IParsingService parsingService,
Logger logger)
: base(parsingService, logger)
: base(configService, parsingService, logger)
{
_configService = configService;
_httpProvider = httpProvider;
_diskProvider = diskProvider;
}

@ -4,6 +4,7 @@ using System.Linq;
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Parser;
@ -18,10 +19,11 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
private readonly ISabnzbdProxy _proxy;
public Sabnzbd(IHttpProvider httpProvider,
IParsingService parsingService,
ISabnzbdProxy proxy,
IConfigService configService,
IParsingService parsingService,
Logger logger)
: base(parsingService, logger)
: base(configService, parsingService, logger)
{
_httpProvider = httpProvider;
_proxy = proxy;
@ -116,7 +118,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
try
{
sabHistory = _proxy.GetHistory(0, 0, Settings);
sabHistory = _proxy.GetHistory(0, _configService.DownloadClientHistoryLimit, Settings);
}
catch (DownloadClientException ex)
{

@ -6,6 +6,7 @@ using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Disk;
using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Organizer;
@ -23,10 +24,11 @@ namespace NzbDrone.Core.Download.Clients.UsenetBlackhole
public UsenetBlackhole(IDiskProvider diskProvider,
IDiskScanService diskScanService,
IParsingService parsingService,
IHttpProvider httpProvider,
IConfigService configService,
IParsingService parsingService,
Logger logger)
: base(parsingService, logger)
: base(configService, parsingService, logger)
{
_diskProvider = diskProvider;
_diskScanService = diskScanService;

@ -5,6 +5,7 @@ using NzbDrone.Core.Indexers;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.ThingiProvider;
using NzbDrone.Core.Configuration;
using NLog;
namespace NzbDrone.Core.Download
@ -12,6 +13,7 @@ namespace NzbDrone.Core.Download
public abstract class DownloadClientBase<TSettings> : IDownloadClient
where TSettings : IProviderConfig, new()
{
protected readonly IConfigService _configService;
private readonly IParsingService _parsingService;
protected readonly Logger _logger;
@ -41,8 +43,9 @@ namespace NzbDrone.Core.Download
}
}
protected DownloadClientBase(IParsingService parsingService, Logger logger)
protected DownloadClientBase(IConfigService configService, IParsingService parsingService, Logger logger)
{
_configService = configService;
_parsingService = parsingService;
_logger = logger;
}

Loading…
Cancel
Save