Compare commits

..

2 Commits

Author SHA1 Message Date
Bogdan
c8b09b9e29 Fixed: Already imported downloads appearing in Queue briefly
(cherry picked from commit 8099ba10afded446779290de29b1baaf0be932c3)

Closes #3538
2024-07-01 08:45:01 +03:00
Bogdan
d910fc42ab Bump mac image to 12 2024-06-26 23:51:49 +03:00
5 changed files with 11 additions and 7 deletions

View File

@@ -20,7 +20,7 @@ variables:
innoVersion: '6.2.0'
windowsImage: 'windows-2022'
linuxImage: 'ubuntu-20.04'
macImage: 'macOS-11'
macImage: 'macOS-12'
trigger:
branches:

View File

@@ -46,6 +46,7 @@ namespace NzbDrone.Core.Test.QueueTests
_trackedDownloads = Builder<TrackedDownload>.CreateListOfSize(1)
.All()
.With(v => v.IsTrackable = true)
.With(v => v.DownloadItem = downloadItem)
.With(v => v.RemoteBook = remoteBook)
.Build()

View File

@@ -62,8 +62,8 @@ namespace NzbDrone.Core.Download
public void Check(TrackedDownload trackedDownload)
{
// Only process tracked downloads that are still downloading or import is blocked (if they fail after attempting to be processed)
if (trackedDownload.State != TrackedDownloadState.Downloading && trackedDownload.State != TrackedDownloadState.ImportBlocked)
// Only process tracked downloads that are still downloading
if (trackedDownload.State != TrackedDownloadState.Downloading)
{
return;
}

View File

@@ -115,7 +115,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads
{
var trackedDownload = _trackedDownloadService.TrackDownload((DownloadClientDefinition)downloadClient.Definition, downloadItem);
if (trackedDownload is { State: TrackedDownloadState.Downloading or TrackedDownloadState.ImportBlocked })
if (trackedDownload != null && trackedDownload.State == TrackedDownloadState.Downloading)
{
_failedDownloadService.Check(trackedDownload);
_completedDownloadService.Check(trackedDownload);

View File

@@ -20,7 +20,7 @@ namespace NzbDrone.Core.Queue
public class QueueService : IQueueService, IHandle<TrackedDownloadRefreshedEvent>
{
private readonly IEventAggregator _eventAggregator;
private static List<Queue> _queue = new List<Queue>();
private static List<Queue> _queue = new ();
private readonly IHistoryService _historyService;
public QueueService(IEventAggregator eventAggregator,
@@ -105,8 +105,11 @@ namespace NzbDrone.Core.Queue
public void Handle(TrackedDownloadRefreshedEvent message)
{
_queue = message.TrackedDownloads.OrderBy(c => c.DownloadItem.RemainingTime).SelectMany(MapQueue)
.ToList();
_queue = message.TrackedDownloads
.Where(t => t.IsTrackable)
.OrderBy(c => c.DownloadItem.RemainingTime)
.SelectMany(MapQueue)
.ToList();
_eventAggregator.PublishEvent(new QueueUpdatedEvent());
}