1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-23 02:05:27 +02:00

Fixed: Already imported downloads appearing in Queue briefly

This commit is contained in:
Bogdan 2024-06-30 20:47:00 +03:00 committed by GitHub
parent 143ccb1e2a
commit 8099ba10af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -44,6 +44,7 @@ public void SetUp()
_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 @@ public interface IQueueService
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,7 +96,10 @@ private Queue MapQueueItem(TrackedDownload trackedDownload, Episode episode)
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();
_eventAggregator.PublishEvent(new QueueUpdatedEvent());