mirror of https://github.com/Radarr/Radarr
Fixed: Failed download handling should now only report a download wasn't grabbed by sonarr if the download actually failed.
This commit is contained in:
parent
30849e6356
commit
6095855102
|
@ -68,6 +68,28 @@ namespace NzbDrone.Core.Test.Download
|
|||
AssertDownloadNotFailed();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_warn_if_matching_history_is_not_found()
|
||||
{
|
||||
_trackedDownload.DownloadItem.Status = DownloadItemStatus.Failed;
|
||||
GivenNoGrabbedHistory();
|
||||
|
||||
Subject.Process(_trackedDownload);
|
||||
|
||||
_trackedDownload.StatusMessages.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_warn_if_matching_history_is_not_found_and_not_failed()
|
||||
{
|
||||
_trackedDownload.DownloadItem.Status = DownloadItemStatus.Failed;
|
||||
GivenNoGrabbedHistory();
|
||||
|
||||
Subject.Process(_trackedDownload);
|
||||
|
||||
_trackedDownload.StatusMessages.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_mark_failed_if_encrypted()
|
||||
{
|
||||
|
|
|
@ -54,24 +54,30 @@ namespace NzbDrone.Core.Download
|
|||
|
||||
public void Process(TrackedDownload trackedDownload)
|
||||
{
|
||||
var grabbedItems = _historyService.Find(trackedDownload.DownloadItem.DownloadId, HistoryEventType.Grabbed)
|
||||
.ToList();
|
||||
|
||||
if (grabbedItems.Empty())
|
||||
{
|
||||
trackedDownload.Warn("Download wasn't grabbed by sonarr, skipping");
|
||||
return;
|
||||
}
|
||||
string failure = null;
|
||||
|
||||
if (trackedDownload.DownloadItem.IsEncrypted)
|
||||
{
|
||||
trackedDownload.State = TrackedDownloadStage.DownloadFailed;
|
||||
PublishDownloadFailedEvent(grabbedItems, "Encrypted download detected", trackedDownload);
|
||||
failure = "Encrypted download detected";
|
||||
}
|
||||
else if (trackedDownload.DownloadItem.Status == DownloadItemStatus.Failed)
|
||||
{
|
||||
failure = trackedDownload.DownloadItem.Message ?? "Failed download detected";
|
||||
}
|
||||
|
||||
if (failure != null)
|
||||
{
|
||||
var grabbedItems = _historyService.Find(trackedDownload.DownloadItem.DownloadId, HistoryEventType.Grabbed)
|
||||
.ToList();
|
||||
|
||||
if (grabbedItems.Empty())
|
||||
{
|
||||
trackedDownload.Warn("Download wasn't grabbed by sonarr, skipping");
|
||||
return;
|
||||
}
|
||||
|
||||
trackedDownload.State = TrackedDownloadStage.DownloadFailed;
|
||||
PublishDownloadFailedEvent(grabbedItems, trackedDownload.DownloadItem.Message, trackedDownload);
|
||||
PublishDownloadFailedEvent(grabbedItems, failure, trackedDownload);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue