@ -15,7 +15,8 @@ namespace NzbDrone.Core.Download.TrackedDownloads
IHandle < EpisodeGrabbedEvent > ,
IHandle < EpisodeImportedEvent >
{
private readonly IProvideDownloadClient _downloadClientProvider ;
private readonly IDownloadClientStatusService _downloadClientStatusService ;
private readonly IDownloadClientFactory _downloadClientFactory ;
private readonly IEventAggregator _eventAggregator ;
private readonly IManageCommandQueue _manageCommandQueue ;
private readonly IConfigService _configService ;
@ -25,16 +26,18 @@ namespace NzbDrone.Core.Download.TrackedDownloads
private readonly Logger _logger ;
private readonly Debouncer _refreshDebounce ;
public DownloadMonitoringService ( IProvideDownloadClient downloadClientProvider ,
IEventAggregator eventAggregator ,
IManageCommandQueue manageCommandQueue ,
IConfigService configService ,
IFailedDownloadService failedDownloadService ,
ICompletedDownloadService completedDownloadService ,
ITrackedDownloadService trackedDownloadService ,
Logger logger )
public DownloadMonitoringService ( IDownloadClientStatusService downloadClientStatusService ,
IDownloadClientFactory downloadClientFactory ,
IEventAggregator eventAggregator ,
IManageCommandQueue manageCommandQueue ,
IConfigService configService ,
IFailedDownloadService failedDownloadService ,
ICompletedDownloadService completedDownloadService ,
ITrackedDownloadService trackedDownloadService ,
Logger logger )
{
_downloadClientProvider = downloadClientProvider ;
_downloadClientStatusService = downloadClientStatusService ;
_downloadClientFactory = downloadClientFactory ;
_eventAggregator = eventAggregator ;
_manageCommandQueue = manageCommandQueue ;
_configService = configService ;
@ -56,7 +59,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads
_refreshDebounce . Pause ( ) ;
try
{
var downloadClients = _downloadClient Provider. GetDownloadClients ( ) ;
var downloadClients = _downloadClient Factory. DownloadHandlingEnabled ( ) ;
var trackedDownloads = new List < TrackedDownload > ( ) ;
@ -84,9 +87,12 @@ namespace NzbDrone.Core.Download.TrackedDownloads
try
{
downloadClientHistory = downloadClient . GetItems ( ) . ToList ( ) ;
_downloadClientStatusService . RecordSuccess ( downloadClient . Definition . Id ) ;
}
catch ( Exception ex )
{
_downloadClientStatusService . RecordFailure ( downloadClient . Definition . Id ) ;
_logger . Warn ( ex , "Unable to retrieve queue and history items from " + downloadClient . Definition . Name ) ;
}