mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04:00
User configurable RSS Sync Time
New: RSS Sync Interval is now user configurable (Default 25 minutes)
This commit is contained in:
@@ -96,7 +96,9 @@ namespace NzbDrone.Core.Jobs
|
||||
|
||||
jobDefinition.Enable = job.DefaultInterval.TotalSeconds > 0;
|
||||
jobDefinition.Name = job.Name;
|
||||
|
||||
jobDefinition.Interval = Convert.ToInt32(job.DefaultInterval.TotalMinutes);
|
||||
//Todo: Need to have a way for users to change this and not have it overwritten on start-up.
|
||||
|
||||
SaveDefinition(jobDefinition);
|
||||
}
|
||||
@@ -196,6 +198,11 @@ namespace NzbDrone.Core.Jobs
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual JobDefinition GetDefinition(Type type)
|
||||
{
|
||||
return _database.Single<JobDefinition>("WHERE TypeName = @0", type.ToString());
|
||||
}
|
||||
|
||||
private void ProcessQueue()
|
||||
{
|
||||
try
|
||||
@@ -321,7 +328,5 @@ namespace NzbDrone.Core.Jobs
|
||||
logger.Trace("resetting queue processor thread");
|
||||
_jobThread = new Thread(ProcessQueue) { Name = "JobQueueThread" };
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ using NLog;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Providers.DecisionEngine;
|
||||
using NzbDrone.Core.Providers.Indexer;
|
||||
using StackExchange.Profiling;
|
||||
@@ -20,19 +21,22 @@ namespace NzbDrone.Core.Jobs
|
||||
private readonly MonitoredEpisodeSpecification _isMonitoredEpisodeSpecification;
|
||||
private readonly AllowedDownloadSpecification _allowedDownloadSpecification;
|
||||
private readonly UpgradeHistorySpecification _upgradeHistorySpecification;
|
||||
private readonly ConfigProvider _configProvider;
|
||||
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public RssSyncJob(DownloadProvider downloadProvider, IndexerProvider indexerProvider,
|
||||
MonitoredEpisodeSpecification isMonitoredEpisodeSpecification, AllowedDownloadSpecification allowedDownloadSpecification, UpgradeHistorySpecification upgradeHistorySpecification)
|
||||
MonitoredEpisodeSpecification isMonitoredEpisodeSpecification, AllowedDownloadSpecification allowedDownloadSpecification,
|
||||
UpgradeHistorySpecification upgradeHistorySpecification, ConfigProvider configProvider)
|
||||
{
|
||||
_downloadProvider = downloadProvider;
|
||||
_indexerProvider = indexerProvider;
|
||||
_isMonitoredEpisodeSpecification = isMonitoredEpisodeSpecification;
|
||||
_allowedDownloadSpecification = allowedDownloadSpecification;
|
||||
_upgradeHistorySpecification = upgradeHistorySpecification;
|
||||
_configProvider = configProvider;
|
||||
}
|
||||
|
||||
public string Name
|
||||
@@ -42,7 +46,7 @@ namespace NzbDrone.Core.Jobs
|
||||
|
||||
public TimeSpan DefaultInterval
|
||||
{
|
||||
get { return TimeSpan.FromMinutes(25); }
|
||||
get { return TimeSpan.FromMinutes(_configProvider.RssSyncInterval); }
|
||||
}
|
||||
|
||||
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)
|
||||
|
||||
@@ -532,6 +532,12 @@ namespace NzbDrone.Core.Providers.Core
|
||||
set { SetValue("RecycleBin", value); }
|
||||
}
|
||||
|
||||
public virtual int RssSyncInterval
|
||||
{
|
||||
get { return GetValueInt("RssSyncInterval", 25); }
|
||||
set { SetValue("RssSyncInterval", value); }
|
||||
}
|
||||
|
||||
private string GetValue(string key)
|
||||
{
|
||||
return GetValue(key, String.Empty);
|
||||
|
||||
Reference in New Issue
Block a user