Fixed performance issues with the QueueModule and limited the number of items the Download Client will fetch as history.
This commit is contained in:
parent
c6e33bc463
commit
1b96a43037
|
@ -2,13 +2,15 @@
|
||||||
using NzbDrone.Api.REST;
|
using NzbDrone.Api.REST;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
|
using NzbDrone.Api.Series;
|
||||||
|
using NzbDrone.Api.Episodes;
|
||||||
|
|
||||||
namespace NzbDrone.Api.Queue
|
namespace NzbDrone.Api.Queue
|
||||||
{
|
{
|
||||||
public class QueueResource : RestResource
|
public class QueueResource : RestResource
|
||||||
{
|
{
|
||||||
public Core.Tv.Series Series { get; set; }
|
public SeriesResource Series { get; set; }
|
||||||
public Episode Episode { get; set; }
|
public EpisodeResource Episode { get; set; }
|
||||||
public QualityModel Quality { get; set; }
|
public QualityModel Quality { get; set; }
|
||||||
public Decimal Size { get; set; }
|
public Decimal Size { get; set; }
|
||||||
public String Title { get; set; }
|
public String Title { get; set; }
|
||||||
|
|
|
@ -10,6 +10,7 @@ using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
using NzbDrone.Core.Tv;
|
using NzbDrone.Core.Tv;
|
||||||
using NzbDrone.Core.Download;
|
using NzbDrone.Core.Download;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||||
{
|
{
|
||||||
|
@ -22,6 +23,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void SetupBase()
|
public void SetupBase()
|
||||||
{
|
{
|
||||||
|
Mocker.GetMock<IConfigService>()
|
||||||
|
.SetupGet(s => s.DownloadClientHistoryLimit)
|
||||||
|
.Returns(30);
|
||||||
|
|
||||||
Mocker.GetMock<IParsingService>()
|
Mocker.GetMock<IParsingService>()
|
||||||
.Setup(s => s.Map(It.IsAny<ParsedEpisodeInfo>(), It.IsAny<int>(), null))
|
.Setup(s => s.Map(It.IsAny<ParsedEpisodeInfo>(), It.IsAny<int>(), null))
|
||||||
.Returns(CreateRemoteEpisode());
|
.Returns(CreateRemoteEpisode());
|
||||||
|
|
|
@ -205,6 +205,13 @@ namespace NzbDrone.Core.Configuration
|
||||||
set { SetValue("DownloadedEpisodesScanInterval", value); }
|
set { SetValue("DownloadedEpisodesScanInterval", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Int32 DownloadClientHistoryLimit
|
||||||
|
{
|
||||||
|
get { return GetValueInt("DownloadClientHistoryLimit", 30); }
|
||||||
|
|
||||||
|
set { SetValue("DownloadClientHistoryLimit", value); }
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean SkipFreeSpaceCheckWhenImporting
|
public Boolean SkipFreeSpaceCheckWhenImporting
|
||||||
{
|
{
|
||||||
get { return GetValueBoolean("SkipFreeSpaceCheckWhenImporting", false); }
|
get { return GetValueBoolean("SkipFreeSpaceCheckWhenImporting", false); }
|
||||||
|
|
|
@ -17,6 +17,7 @@ namespace NzbDrone.Core.Configuration
|
||||||
String DownloadedEpisodesFolder { get; set; }
|
String DownloadedEpisodesFolder { get; set; }
|
||||||
String DownloadClientWorkingFolders { get; set; }
|
String DownloadClientWorkingFolders { get; set; }
|
||||||
Int32 DownloadedEpisodesScanInterval { get; set; }
|
Int32 DownloadedEpisodesScanInterval { get; set; }
|
||||||
|
Int32 DownloadClientHistoryLimit { get; set; }
|
||||||
|
|
||||||
//Completed/Failed Download Handling (Download client)
|
//Completed/Failed Download Handling (Download client)
|
||||||
Boolean EnableCompletedDownloadHandling { get; set; }
|
Boolean EnableCompletedDownloadHandling { get; set; }
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Messaging.Commands;
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
|
@ -18,10 +19,11 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
|
||||||
private readonly IHttpProvider _httpProvider;
|
private readonly IHttpProvider _httpProvider;
|
||||||
|
|
||||||
public Nzbget(INzbgetProxy proxy,
|
public Nzbget(INzbgetProxy proxy,
|
||||||
|
IConfigService configService,
|
||||||
IParsingService parsingService,
|
IParsingService parsingService,
|
||||||
IHttpProvider httpProvider,
|
IHttpProvider httpProvider,
|
||||||
Logger logger)
|
Logger logger)
|
||||||
: base(parsingService, logger)
|
: base(configService, parsingService, logger)
|
||||||
{
|
{
|
||||||
_proxy = proxy;
|
_proxy = proxy;
|
||||||
_httpProvider = httpProvider;
|
_httpProvider = httpProvider;
|
||||||
|
@ -139,7 +141,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
history = _proxy.GetHistory(Settings);
|
history = _proxy.GetHistory(Settings).Take(_configService.DownloadClientHistoryLimit).ToList();
|
||||||
}
|
}
|
||||||
catch (DownloadClientException ex)
|
catch (DownloadClientException ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,20 +17,18 @@ namespace NzbDrone.Core.Download.Clients.Pneumatic
|
||||||
{
|
{
|
||||||
public class Pneumatic : DownloadClientBase<PneumaticSettings>, IExecute<TestPneumaticCommand>
|
public class Pneumatic : DownloadClientBase<PneumaticSettings>, IExecute<TestPneumaticCommand>
|
||||||
{
|
{
|
||||||
private readonly IConfigService _configService;
|
|
||||||
private readonly IHttpProvider _httpProvider;
|
private readonly IHttpProvider _httpProvider;
|
||||||
private readonly IDiskProvider _diskProvider;
|
private readonly IDiskProvider _diskProvider;
|
||||||
|
|
||||||
private static readonly Logger logger = NzbDroneLogger.GetLogger();
|
private static readonly Logger logger = NzbDroneLogger.GetLogger();
|
||||||
|
|
||||||
public Pneumatic(IConfigService configService,
|
public Pneumatic(IHttpProvider httpProvider,
|
||||||
IHttpProvider httpProvider,
|
|
||||||
IDiskProvider diskProvider,
|
IDiskProvider diskProvider,
|
||||||
|
IConfigService configService,
|
||||||
IParsingService parsingService,
|
IParsingService parsingService,
|
||||||
Logger logger)
|
Logger logger)
|
||||||
: base(parsingService, logger)
|
: base(configService, parsingService, logger)
|
||||||
{
|
{
|
||||||
_configService = configService;
|
|
||||||
_httpProvider = httpProvider;
|
_httpProvider = httpProvider;
|
||||||
_diskProvider = diskProvider;
|
_diskProvider = diskProvider;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Messaging.Commands;
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
|
@ -18,10 +19,11 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
||||||
private readonly ISabnzbdProxy _proxy;
|
private readonly ISabnzbdProxy _proxy;
|
||||||
|
|
||||||
public Sabnzbd(IHttpProvider httpProvider,
|
public Sabnzbd(IHttpProvider httpProvider,
|
||||||
IParsingService parsingService,
|
|
||||||
ISabnzbdProxy proxy,
|
ISabnzbdProxy proxy,
|
||||||
|
IConfigService configService,
|
||||||
|
IParsingService parsingService,
|
||||||
Logger logger)
|
Logger logger)
|
||||||
: base(parsingService, logger)
|
: base(configService, parsingService, logger)
|
||||||
{
|
{
|
||||||
_httpProvider = httpProvider;
|
_httpProvider = httpProvider;
|
||||||
_proxy = proxy;
|
_proxy = proxy;
|
||||||
|
@ -116,7 +118,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sabHistory = _proxy.GetHistory(0, 0, Settings);
|
sabHistory = _proxy.GetHistory(0, _configService.DownloadClientHistoryLimit, Settings);
|
||||||
}
|
}
|
||||||
catch (DownloadClientException ex)
|
catch (DownloadClientException ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,6 +6,7 @@ using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Common.Disk;
|
using NzbDrone.Common.Disk;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Messaging.Commands;
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
using NzbDrone.Core.Organizer;
|
using NzbDrone.Core.Organizer;
|
||||||
|
@ -23,10 +24,11 @@ namespace NzbDrone.Core.Download.Clients.UsenetBlackhole
|
||||||
|
|
||||||
public UsenetBlackhole(IDiskProvider diskProvider,
|
public UsenetBlackhole(IDiskProvider diskProvider,
|
||||||
IDiskScanService diskScanService,
|
IDiskScanService diskScanService,
|
||||||
IParsingService parsingService,
|
|
||||||
IHttpProvider httpProvider,
|
IHttpProvider httpProvider,
|
||||||
|
IConfigService configService,
|
||||||
|
IParsingService parsingService,
|
||||||
Logger logger)
|
Logger logger)
|
||||||
: base(parsingService, logger)
|
: base(configService, parsingService, logger)
|
||||||
{
|
{
|
||||||
_diskProvider = diskProvider;
|
_diskProvider = diskProvider;
|
||||||
_diskScanService = diskScanService;
|
_diskScanService = diskScanService;
|
||||||
|
|
|
@ -5,6 +5,7 @@ using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.ThingiProvider;
|
using NzbDrone.Core.ThingiProvider;
|
||||||
|
using NzbDrone.Core.Configuration;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Download
|
namespace NzbDrone.Core.Download
|
||||||
|
@ -12,6 +13,7 @@ namespace NzbDrone.Core.Download
|
||||||
public abstract class DownloadClientBase<TSettings> : IDownloadClient
|
public abstract class DownloadClientBase<TSettings> : IDownloadClient
|
||||||
where TSettings : IProviderConfig, new()
|
where TSettings : IProviderConfig, new()
|
||||||
{
|
{
|
||||||
|
protected readonly IConfigService _configService;
|
||||||
private readonly IParsingService _parsingService;
|
private readonly IParsingService _parsingService;
|
||||||
protected readonly Logger _logger;
|
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;
|
_parsingService = parsingService;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue