You've already forked Sonarr
							
							
				mirror of
				https://github.com/Sonarr/Sonarr.git
				synced 2025-10-31 00:07:55 +02:00 
			
		
		
		
	renamed FailedDownloadCommand to CheckForFailedDownloadCommand
This commit is contained in:
		| @@ -95,7 +95,7 @@ namespace NzbDrone.Core.Test.Download | ||||
|                   .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 @@ namespace NzbDrone.Core.Test.Download | ||||
|                   .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 @@ namespace NzbDrone.Core.Test.Download | ||||
|             GivenNoGrabbedHistory(); | ||||
|             GivenFailedDownloadClientHistory(); | ||||
| 
 | ||||
|             Subject.Execute(new FailedDownloadCommand()); | ||||
|             Subject.Execute(new CheckForFailedDownloadCommand()); | ||||
| 
 | ||||
|             VerifyNoFailedDownloads(); | ||||
|         } | ||||
| @@ -146,7 +146,7 @@ namespace NzbDrone.Core.Test.Download | ||||
|             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 @@ namespace NzbDrone.Core.Test.Download | ||||
|             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 @@ namespace NzbDrone.Core.Test.Download | ||||
|                 h.Data.Add("downloadClientId", _failed.First().Id); | ||||
|             }); | ||||
| 
 | ||||
|             Subject.Execute(new FailedDownloadCommand()); | ||||
|             Subject.Execute(new CheckForFailedDownloadCommand()); | ||||
| 
 | ||||
|             VerifyFailedDownloads(2); | ||||
|         } | ||||
| @@ -201,7 +201,7 @@ namespace NzbDrone.Core.Test.Download | ||||
|                   .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 @@ namespace NzbDrone.Core.Download | ||||
|         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 @@ namespace NzbDrone.Core.Download | ||||
|         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 @@ namespace NzbDrone.Core.Download | ||||
|             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 = 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" /> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user