mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-09 04:22:30 +01:00
renamed FailedDownloadCommand to CheckForFailedDownloadCommand
This commit is contained in:
parent
4ed15f0db8
commit
150b14aaeb
@ -95,7 +95,7 @@ public void should_not_process_if_no_download_client_history()
|
||||
.Setup(s => s.GetHistory(0, 20))
|
||||
.Returns(new List<HistoryItem>());
|
||||
|
||||
Subject.Execute(new FailedDownloadCommand());
|
||||
Subject.Execute(new CheckForFailedDownloadCommand());
|
||||
|
||||
Mocker.GetMock<IHistoryService>()
|
||||
.Verify(s => s.BetweenDates(It.IsAny<DateTime>(), It.IsAny<DateTime>(), HistoryEventType.Grabbed),
|
||||
@ -111,7 +111,7 @@ public void should_not_process_if_no_failed_items_in_download_client_history()
|
||||
.Setup(s => s.GetHistory(0, 20))
|
||||
.Returns(_completed);
|
||||
|
||||
Subject.Execute(new FailedDownloadCommand());
|
||||
Subject.Execute(new CheckForFailedDownloadCommand());
|
||||
|
||||
Mocker.GetMock<IHistoryService>()
|
||||
.Verify(s => s.BetweenDates(It.IsAny<DateTime>(), It.IsAny<DateTime>(), HistoryEventType.Grabbed),
|
||||
@ -126,7 +126,7 @@ public void should_not_process_if_matching_history_is_not_found()
|
||||
GivenNoGrabbedHistory();
|
||||
GivenFailedDownloadClientHistory();
|
||||
|
||||
Subject.Execute(new FailedDownloadCommand());
|
||||
Subject.Execute(new CheckForFailedDownloadCommand());
|
||||
|
||||
VerifyNoFailedDownloads();
|
||||
}
|
||||
@ -146,7 +146,7 @@ public void should_not_process_if_already_added_to_history_as_failed()
|
||||
history.First().Data.Add("downloadClient", "SabnzbdClient");
|
||||
history.First().Data.Add("downloadClientId", _failed.First().Id);
|
||||
|
||||
Subject.Execute(new FailedDownloadCommand());
|
||||
Subject.Execute(new CheckForFailedDownloadCommand());
|
||||
|
||||
VerifyNoFailedDownloads();
|
||||
}
|
||||
@ -166,7 +166,7 @@ public void should_process_if_not_already_in_failed_history()
|
||||
history.First().Data.Add("downloadClient", "SabnzbdClient");
|
||||
history.First().Data.Add("downloadClientId", _failed.First().Id);
|
||||
|
||||
Subject.Execute(new FailedDownloadCommand());
|
||||
Subject.Execute(new CheckForFailedDownloadCommand());
|
||||
|
||||
VerifyFailedDownloads();
|
||||
}
|
||||
@ -189,7 +189,7 @@ public void should_have_multiple_episode_ids_when_multi_episode_release_fails()
|
||||
h.Data.Add("downloadClientId", _failed.First().Id);
|
||||
});
|
||||
|
||||
Subject.Execute(new FailedDownloadCommand());
|
||||
Subject.Execute(new CheckForFailedDownloadCommand());
|
||||
|
||||
VerifyFailedDownloads(2);
|
||||
}
|
||||
@ -201,7 +201,7 @@ public void should_skip_if_enable_failed_download_handling_is_off()
|
||||
.SetupGet(s => s.EnableFailedDownloadHandling)
|
||||
.Returns(false);
|
||||
|
||||
Subject.Execute(new FailedDownloadCommand());
|
||||
Subject.Execute(new CheckForFailedDownloadCommand());
|
||||
|
||||
VerifyNoFailedDownloads();
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace NzbDrone.Core.Download
|
||||
{
|
||||
public class FailedDownloadCommand : Command
|
||||
public class CheckForFailedDownloadCommand : Command
|
||||
{
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.History;
|
||||
@ -13,7 +14,7 @@ public interface IFailedDownloadService
|
||||
void MarkAsFailed(int historyId);
|
||||
}
|
||||
|
||||
public class FailedDownloadService : IFailedDownloadService, IExecute<FailedDownloadCommand>
|
||||
public class FailedDownloadService : IFailedDownloadService, IExecute<CheckForFailedDownloadCommand>
|
||||
{
|
||||
private readonly IProvideDownloadClient _downloadClientProvider;
|
||||
private readonly IHistoryService _historyService;
|
||||
@ -40,22 +41,7 @@ public FailedDownloadService(IProvideDownloadClient downloadClientProvider,
|
||||
public void MarkAsFailed(int historyId)
|
||||
{
|
||||
var item = _historyService.Get(historyId);
|
||||
PublishDownloadFailedEvent(new List<History.History> {item}, "Manually marked as failed");
|
||||
}
|
||||
|
||||
private void CheckForFailedDownloads()
|
||||
{
|
||||
if (!_configService.EnableFailedDownloadHandling)
|
||||
{
|
||||
_logger.Trace("Failed Download Handling is not enabled");
|
||||
return;
|
||||
}
|
||||
|
||||
var grabbedHistory = _historyService.Grabbed();
|
||||
var failedHistory = _historyService.Failed();
|
||||
|
||||
CheckQueue(grabbedHistory, failedHistory);
|
||||
CheckHistory(grabbedHistory, failedHistory);
|
||||
PublishDownloadFailedEvent(new List<History.History> { item }, "Manually marked as failed");
|
||||
}
|
||||
|
||||
private void CheckQueue(List<History.History> grabbedHistory, List<History.History> failedHistory)
|
||||
@ -163,9 +149,19 @@ private IDownloadClient GetDownloadClient()
|
||||
return _downloadClientProvider.GetDownloadClient();
|
||||
}
|
||||
|
||||
public void Execute(FailedDownloadCommand message)
|
||||
public void Execute(CheckForFailedDownloadCommand message)
|
||||
{
|
||||
CheckForFailedDownloads();
|
||||
if (!_configService.EnableFailedDownloadHandling)
|
||||
{
|
||||
_logger.Trace("Failed Download Handling is not enabled");
|
||||
return;
|
||||
}
|
||||
|
||||
var grabbedHistory = _historyService.Grabbed();
|
||||
var failedHistory = _historyService.Failed();
|
||||
|
||||
CheckQueue(grabbedHistory, failedHistory);
|
||||
CheckHistory(grabbedHistory, failedHistory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public void Handle(ApplicationStartedEvent message)
|
||||
new ScheduledTask{ Interval = 3*60, TypeName = typeof(UpdateSceneMappingCommand).FullName},
|
||||
new ScheduledTask{ Interval = 1, TypeName = typeof(TrackedCommandCleanupCommand).FullName},
|
||||
new ScheduledTask{ Interval = 24*60, TypeName = typeof(HousekeepingCommand).FullName},
|
||||
new ScheduledTask{ Interval = 1, TypeName = typeof(FailedDownloadCommand).FullName}
|
||||
new ScheduledTask{ Interval = 1, TypeName = typeof(CheckForFailedDownloadCommand).FullName}
|
||||
};
|
||||
|
||||
var currentTasks = _scheduledTaskRepository.All();
|
||||
|
@ -233,7 +233,7 @@
|
||||
<Compile Include="Download\Clients\Sabnzbd\JsonConverters\SabnzbdQueueTimeConverter.cs" />
|
||||
<Compile Include="Download\Clients\Sabnzbd\SabAutoConfigureService.cs" />
|
||||
<Compile Include="Download\Clients\Sabnzbd\SabCommunicationProxy.cs" />
|
||||
<Compile Include="Download\FailedDownloadCommand.cs" />
|
||||
<Compile Include="Download\CheckForFailedDownloadCommand.cs" />
|
||||
<Compile Include="Download\HistoryItem.cs" />
|
||||
<Compile Include="Download\DownloadFailedEvent.cs" />
|
||||
<Compile Include="Download\DownloadApprovedReports.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user