From 8099ba10afded446779290de29b1baaf0be932c3 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sun, 30 Jun 2024 20:47:00 +0300 Subject: [PATCH] Fixed: Already imported downloads appearing in Queue briefly --- src/NzbDrone.Core.Test/QueueTests/QueueServiceFixture.cs | 1 + src/NzbDrone.Core/Queue/QueueService.cs | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core.Test/QueueTests/QueueServiceFixture.cs b/src/NzbDrone.Core.Test/QueueTests/QueueServiceFixture.cs index 6d1fbe328..0d205e2c9 100644 --- a/src/NzbDrone.Core.Test/QueueTests/QueueServiceFixture.cs +++ b/src/NzbDrone.Core.Test/QueueTests/QueueServiceFixture.cs @@ -44,6 +44,7 @@ public void SetUp() _trackedDownloads = Builder.CreateListOfSize(1) .All() + .With(v => v.IsTrackable = true) .With(v => v.DownloadItem = downloadItem) .With(v => v.RemoteEpisode = remoteEpisode) .Build() diff --git a/src/NzbDrone.Core/Queue/QueueService.cs b/src/NzbDrone.Core/Queue/QueueService.cs index 3d7078223..8bb11a13c 100644 --- a/src/NzbDrone.Core/Queue/QueueService.cs +++ b/src/NzbDrone.Core/Queue/QueueService.cs @@ -20,7 +20,7 @@ public interface IQueueService public class QueueService : IQueueService, IHandle { private readonly IEventAggregator _eventAggregator; - private static List _queue = new List(); + private static List _queue = new (); public QueueService(IEventAggregator eventAggregator) { @@ -96,8 +96,11 @@ private Queue MapQueueItem(TrackedDownload trackedDownload, Episode episode) 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()); }