mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: Refresh Xem mapped series list every 12 hours, instead of on startup only
This commit is contained in:
@@ -2,13 +2,14 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Cache;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Tv.Events;
|
||||
|
||||
namespace NzbDrone.Core.DataAugmentation.Xem
|
||||
{
|
||||
public class XemService : IHandle<SeriesUpdatedEvent>
|
||||
public class XemService : IHandle<SeriesUpdatedEvent>, IExecute<RefreshXemCacheCommand>
|
||||
{
|
||||
private readonly IEpisodeService _episodeService;
|
||||
private readonly IXemProxy _xemProxy;
|
||||
@@ -28,23 +29,6 @@ namespace NzbDrone.Core.DataAugmentation.Xem
|
||||
_cache = cacheManger.GetCache<bool>(GetType());
|
||||
}
|
||||
|
||||
|
||||
public void Handle(SeriesUpdatedEvent message)
|
||||
{
|
||||
if (_cache.Count == 0)
|
||||
{
|
||||
RefreshCache();
|
||||
}
|
||||
|
||||
if (!_cache.Find(message.Series.TvdbId.ToString()))
|
||||
{
|
||||
_logger.Trace("Scene numbering is not available for {0} [{1}]", message.Series.Title, message.Series.TvdbId);
|
||||
return;
|
||||
}
|
||||
|
||||
PerformUpdate(message.Series);
|
||||
}
|
||||
|
||||
private void PerformUpdate(Series series)
|
||||
{
|
||||
_logger.Trace("Updating scene numbering mapping for: {0}", series);
|
||||
@@ -109,5 +93,26 @@ namespace NzbDrone.Core.DataAugmentation.Xem
|
||||
_cache.Set(id.ToString(), true, TimeSpan.FromHours(1));
|
||||
}
|
||||
}
|
||||
|
||||
public void Handle(SeriesUpdatedEvent message)
|
||||
{
|
||||
if (_cache.Count == 0)
|
||||
{
|
||||
RefreshCache();
|
||||
}
|
||||
|
||||
if (!_cache.Find(message.Series.TvdbId.ToString()))
|
||||
{
|
||||
_logger.Trace("Scene numbering is not available for {0} [{1}]", message.Series.Title, message.Series.TvdbId);
|
||||
return;
|
||||
}
|
||||
|
||||
PerformUpdate(message.Series);
|
||||
}
|
||||
|
||||
public void Execute(RefreshXemCacheCommand message)
|
||||
{
|
||||
RefreshCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user