Mark completed imports based on history as imported to remove from queue

This commit is contained in:
Mark McDowall 2020-09-08 14:52:03 -07:00
parent b35fd7e507
commit accf8d5c81
1 changed files with 18 additions and 12 deletions

View File

@ -171,15 +171,15 @@ namespace NzbDrone.Core.Download
if (allEpisodesImportedInHistory) if (allEpisodesImportedInHistory)
{ {
// Log different error messages depending on the circumstances, but treat both as fully imported, because that's the reality.
// The second message shouldn't be logged in most cases, but continued reporting would indicate an ongoing issue.
if (atLeastOneEpisodeImported) if (atLeastOneEpisodeImported)
{ {
_logger.Debug("All episodes were imported in history for {0}", trackedDownload.DownloadItem.Title); _logger.Debug("All episodes were imported in history for {0}", trackedDownload.DownloadItem.Title);
trackedDownload.State = TrackedDownloadState.Imported;
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, trackedDownload.RemoteEpisode.Series.Id));
return true;
} }
else
{
_logger.Debug() _logger.Debug()
.Message("No Episodes were just imported, but all episodes were previously imported, possible issue with download history.") .Message("No Episodes were just imported, but all episodes were previously imported, possible issue with download history.")
.Property("SeriesId", trackedDownload.RemoteEpisode.Series.Id) .Property("SeriesId", trackedDownload.RemoteEpisode.Series.Id)
@ -190,6 +190,12 @@ namespace NzbDrone.Core.Download
.Write(); .Write();
} }
trackedDownload.State = TrackedDownloadState.Imported;
_eventAggregator.PublishEvent(new DownloadCompletedEvent(trackedDownload, trackedDownload.RemoteEpisode.Series.Id));
return true;
}
_logger.Debug("Not all episodes have been imported for {0}", trackedDownload.DownloadItem.Title); _logger.Debug("Not all episodes have been imported for {0}", trackedDownload.DownloadItem.Title);
return false; return false;
} }