Fixed: Use only trackable downloads in queue

This commit is contained in:
Bogdan 2024-06-30 07:37:11 +03:00
parent 143ccb1e2a
commit eca05e67ee
2 changed files with 7 additions and 3 deletions

View File

@ -44,6 +44,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.RemoteEpisode = remoteEpisode)
.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 ();
public QueueService(IEventAggregator eventAggregator)
{
@ -96,8 +96,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());
}