Fixed: Refresh Xem mapped series list every 12 hours, instead of on startup only

pull/3113/head
Mark McDowall 11 years ago
parent 9484e7d2a9
commit 68d1c421ba

@ -0,0 +1,8 @@
using NzbDrone.Core.Messaging.Commands;
namespace NzbDrone.Core.DataAugmentation.Xem
{
public class RefreshXemCacheCommand : Command
{
}
}

@ -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();
}
}
}

@ -47,14 +47,16 @@ namespace NzbDrone.Core.Jobs
var defaultTasks = new[]
{
new ScheduledTask{ Interval = _configService.RssSyncInterval, TypeName = typeof(RssSyncCommand).FullName},
new ScheduledTask{ Interval = 12*60, TypeName = typeof(RefreshSeriesCommand).FullName},
new ScheduledTask{ Interval = 1, TypeName = typeof(DownloadedEpisodesScanCommand).FullName},
new ScheduledTask{ Interval = 60, TypeName = typeof(ApplicationUpdateCommand).FullName},
new ScheduledTask{ Interval = 1, TypeName = typeof(TrackedCommandCleanupCommand).FullName},
new ScheduledTask{ Interval = 1, TypeName = typeof(CheckForFailedDownloadCommand).FullName},
new ScheduledTask{ Interval = 1*60, TypeName = typeof(ApplicationUpdateCommand).FullName},
new ScheduledTask{ Interval = 1*60, TypeName = typeof(TrimLogCommand).FullName},
new ScheduledTask{ Interval = 3*60, TypeName = typeof(UpdateSceneMappingCommand).FullName},
new ScheduledTask{ Interval = 1, TypeName = typeof(TrackedCommandCleanupCommand).FullName},
new ScheduledTask{ Interval = 12*60, TypeName = typeof(RefreshXemCacheCommand).FullName},
new ScheduledTask{ Interval = 12*60, TypeName = typeof(RefreshSeriesCommand).FullName},
new ScheduledTask{ Interval = 24*60, TypeName = typeof(HousekeepingCommand).FullName},
new ScheduledTask{ Interval = 1, TypeName = typeof(CheckForFailedDownloadCommand).FullName}
};
var currentTasks = _scheduledTaskRepository.All();

Loading…
Cancel
Save