mirror of
https://github.com/Readarr/Readarr
synced 2026-05-05 11:10:37 +02:00
Fixed: Already imported downloads appearing in Queue briefly
(cherry picked from commit 8099ba10afded446779290de29b1baaf0be932c3) Closes #3538
This commit is contained in:
parent
d910fc42ab
commit
c8b09b9e29
2 changed files with 7 additions and 3 deletions
|
|
@ -46,6 +46,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.RemoteBook = remoteBook)
|
.With(v => v.RemoteBook = remoteBook)
|
||||||
.Build()
|
.Build()
|
||||||
|
|
|
||||||
|
|
@ -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 ();
|
||||||
private readonly IHistoryService _historyService;
|
private readonly IHistoryService _historyService;
|
||||||
|
|
||||||
public QueueService(IEventAggregator eventAggregator,
|
public QueueService(IEventAggregator eventAggregator,
|
||||||
|
|
@ -105,8 +105,11 @@ private Queue MapQueueItem(TrackedDownload trackedDownload, Book book)
|
||||||
|
|
||||||
public void Handle(TrackedDownloadRefreshedEvent message)
|
public void Handle(TrackedDownloadRefreshedEvent message)
|
||||||
{
|
{
|
||||||
_queue = message.TrackedDownloads.OrderBy(c => c.DownloadItem.RemainingTime).SelectMany(MapQueue)
|
_queue = message.TrackedDownloads
|
||||||
.ToList();
|
.Where(t => t.IsTrackable)
|
||||||
|
.OrderBy(c => c.DownloadItem.RemainingTime)
|
||||||
|
.SelectMany(MapQueue)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
_eventAggregator.PublishEvent(new QueueUpdatedEvent());
|
_eventAggregator.PublishEvent(new QueueUpdatedEvent());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue