mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-23 00:07:07 +00:00
New: Refresh cache for tracked queue on series add
This commit is contained in:
parent
e07eb05e8b
commit
ea54ade9bf
1 changed files with 22 additions and 4 deletions
|
@ -28,6 +28,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads
|
|||
|
||||
public class TrackedDownloadService : ITrackedDownloadService,
|
||||
IHandle<EpisodeInfoRefreshedEvent>,
|
||||
IHandle<SeriesAddedEvent>,
|
||||
IHandle<SeriesDeletedEvent>
|
||||
{
|
||||
private readonly IParsingService _parsingService;
|
||||
|
@ -278,12 +279,29 @@ namespace NzbDrone.Core.Download.TrackedDownloads
|
|||
}
|
||||
}
|
||||
|
||||
public void Handle(SeriesAddedEvent message)
|
||||
{
|
||||
var cachedItems = _cache.Values
|
||||
.Where(t =>
|
||||
t.RemoteEpisode?.Series == null ||
|
||||
message.Series?.TvdbId == t.RemoteEpisode.Series.TvdbId)
|
||||
.ToList();
|
||||
|
||||
if (cachedItems.Any())
|
||||
{
|
||||
cachedItems.ForEach(UpdateCachedItem);
|
||||
|
||||
_eventAggregator.PublishEvent(new TrackedDownloadRefreshedEvent(GetTrackedDownloads()));
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(SeriesDeletedEvent message)
|
||||
{
|
||||
var cachedItems = _cache.Values.Where(t =>
|
||||
t.RemoteEpisode?.Series != null &&
|
||||
message.Series.Any(s => s.Id == t.RemoteEpisode.Series.Id))
|
||||
.ToList();
|
||||
var cachedItems = _cache.Values
|
||||
.Where(t =>
|
||||
t.RemoteEpisode?.Series != null &&
|
||||
message.Series.Any(s => s.Id == t.RemoteEpisode.Series.Id || s.TvdbId == t.RemoteEpisode.Series.TvdbId))
|
||||
.ToList();
|
||||
|
||||
if (cachedItems.Any())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue