1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2025-03-04 02:18:06 +00:00

Fixed: Already imported downloads appearing in Queue briefly

(cherry picked from commit 8099ba10afded446779290de29b1baaf0be932c3)

Closes #4877
This commit is contained in:
Bogdan 2024-06-30 20:47:00 +03:00
parent bc19ead182
commit bfcbb67054
2 changed files with 7 additions and 3 deletions

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.RemoteAlbum = remoteAlbum)
.Build()

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,
@ -106,8 +106,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());
}