1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-19 17:32:38 +01:00

Fixed: Already imported downloads appearing in Queue briefly

(cherry picked from commit 8099ba10afded446779290de29b1baaf0be932c3)
This commit is contained in:
Bogdan 2024-06-30 20:47:00 +03:00
parent 126a5b118e
commit b5e6a36878
2 changed files with 7 additions and 3 deletions

View File

@ -38,6 +38,7 @@ public void SetUp()
_trackedDownloads = Builder<TrackedDownload>.CreateListOfSize(1) _trackedDownloads = Builder<TrackedDownload>.CreateListOfSize(1)
.All() .All()
.With(v => v.IsTrackable = true)
.With(v => v.DownloadItem = downloadItem) .With(v => v.DownloadItem = downloadItem)
.With(v => v.RemoteMovie = remoteEpisode) .With(v => v.RemoteMovie = remoteEpisode)
.Build() .Build()

View File

@ -20,7 +20,7 @@ public interface IQueueService
public class QueueService : IQueueService, IHandle<TrackedDownloadRefreshedEvent> public class QueueService : IQueueService, IHandle<TrackedDownloadRefreshedEvent>
{ {
private readonly IEventAggregator _eventAggregator; private readonly IEventAggregator _eventAggregator;
private static List<Queue> _queue = new List<Queue>(); private static List<Queue> _queue = new ();
public QueueService(IEventAggregator eventAggregator) public QueueService(IEventAggregator eventAggregator)
{ {
@ -92,7 +92,10 @@ private Queue MapMovie(TrackedDownload trackedDownload, Movie movie)
public void Handle(TrackedDownloadRefreshedEvent message) public void Handle(TrackedDownloadRefreshedEvent message)
{ {
_queue = message.TrackedDownloads.OrderBy(c => c.DownloadItem.RemainingTime).SelectMany(MapQueue) _queue = message.TrackedDownloads
.Where(t => t.IsTrackable)
.OrderBy(c => c.DownloadItem.RemainingTime)
.SelectMany(MapQueue)
.ToList(); .ToList();
_eventAggregator.PublishEvent(new QueueUpdatedEvent()); _eventAggregator.PublishEvent(new QueueUpdatedEvent());