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