1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2025-03-03 18:26:42 +00:00

New: Refresh cache for tracked queue on series update

This commit is contained in:
Bogdan 2025-01-31 18:06:55 +02:00 committed by Mark McDowall
parent bb0ad312f1
commit 5208f5e966
No known key found for this signature in database

View file

@ -29,6 +29,8 @@ namespace NzbDrone.Core.Download.TrackedDownloads
public class TrackedDownloadService : ITrackedDownloadService,
IHandle<EpisodeInfoRefreshedEvent>,
IHandle<SeriesAddedEvent>,
IHandle<SeriesEditedEvent>,
IHandle<SeriesBulkEditedEvent>,
IHandle<SeriesDeletedEvent>
{
private readonly IParsingService _parsingService;
@ -305,6 +307,38 @@ namespace NzbDrone.Core.Download.TrackedDownloads
}
}
public void Handle(SeriesEditedEvent message)
{
var cachedItems = _cache.Values
.Where(t =>
t.RemoteEpisode?.Series != null &&
(t.RemoteEpisode.Series.Id == message.Series?.Id || t.RemoteEpisode.Series.TvdbId == message.Series?.TvdbId))
.ToList();
if (cachedItems.Any())
{
cachedItems.ForEach(UpdateCachedItem);
_eventAggregator.PublishEvent(new TrackedDownloadRefreshedEvent(GetTrackedDownloads()));
}
}
public void Handle(SeriesBulkEditedEvent message)
{
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())
{
cachedItems.ForEach(UpdateCachedItem);
_eventAggregator.PublishEvent(new TrackedDownloadRefreshedEvent(GetTrackedDownloads()));
}
}
public void Handle(SeriesDeletedEvent message)
{
var cachedItems = _cache.Values