New: Allow CheckForFinishedDownloadInterval to be set from the UI (#3233)

* Adding CheckForFinishedDownloadInterval to config service
Changed TaskManager to use a configurable interval for CheckForFinishedDownloadCommand

* Adding new CheckForFinishedDownloadInterval to UI

Fixes #840
pull/3515/head
Steven Crouchman 5 years ago committed by Leonardo Galli
parent 9985554dcb
commit f411903e90

@ -1,4 +1,4 @@
using NzbDrone.Api.REST;
using NzbDrone.Api.REST;
using NzbDrone.Core.Configuration;
namespace NzbDrone.Api.Config
@ -11,6 +11,7 @@ namespace NzbDrone.Api.Config
public bool EnableCompletedDownloadHandling { get; set; }
public bool RemoveCompletedDownloads { get; set; }
public int CheckForFinishedDownloadInterval { get; set; }
public bool AutoRedownloadFailed { get; set; }
public bool RemoveFailedDownloads { get; set; }
@ -28,6 +29,7 @@ namespace NzbDrone.Api.Config
EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling,
RemoveCompletedDownloads = model.RemoveCompletedDownloads,
CheckForFinishedDownloadInterval = model.CheckForFinishedDownloadInterval,
AutoRedownloadFailed = model.AutoRedownloadFailed,
RemoveFailedDownloads = model.RemoveFailedDownloads

@ -273,6 +273,13 @@ namespace NzbDrone.Core.Configuration
set { SetValue("DownloadedMoviesScanInterval", value); }
}
public int CheckForFinishedDownloadInterval
{
get { return GetValueInt("CheckForFinishedDownloadInterval", 1); }
set { SetValue("CheckForFinishedDownloadInterval", value); }
}
public int DownloadClientHistoryLimit
{
get { return GetValueInt("DownloadClientHistoryLimit", 30); }

@ -16,6 +16,7 @@ namespace NzbDrone.Core.Configuration
string DownloadClientWorkingFolders { get; set; }
int DownloadedMoviesScanInterval { get; set; }
int DownloadClientHistoryLimit { get; set; }
int CheckForFinishedDownloadInterval { get; set; }
//Completed/Failed Download Handling (Download client)
bool EnableCompletedDownloadHandling { get; set; }

@ -71,7 +71,6 @@ namespace NzbDrone.Core.Jobs
var defaultTasks = new[]
{
new ScheduledTask{ Interval = 1, TypeName = typeof(CheckForFinishedDownloadCommand).FullName},
new ScheduledTask{ Interval = 1*60, TypeName = typeof(PreDBSyncCommand).FullName},
new ScheduledTask{ Interval = 5, TypeName = typeof(MessagingCleanupCommand).FullName},
new ScheduledTask{ Interval = updateInterval, TypeName = typeof(ApplicationUpdateCommand).FullName},
@ -98,6 +97,12 @@ namespace NzbDrone.Core.Jobs
Interval = _configService.DownloadedMoviesScanInterval,
TypeName = typeof(DownloadedMoviesScanCommand).FullName
},
new ScheduledTask
{
Interval = Math.Max(_configService.CheckForFinishedDownloadInterval, 1),
TypeName = typeof(CheckForFinishedDownloadCommand).FullName
},
};
var currentTasks = _scheduledTaskRepository.All().ToList();
@ -184,7 +189,10 @@ namespace NzbDrone.Core.Jobs
var netImport = _scheduledTaskRepository.GetDefinition(typeof(NetImportSyncCommand));
netImport.Interval = _configService.NetImportSyncInterval;
_scheduledTaskRepository.UpdateMany(new List<ScheduledTask> { rss, downloadedMovies, netImport });
var checkForFinishedDownloads = _scheduledTaskRepository.GetDefinition(typeof(CheckForFinishedDownloadCommand));
checkForFinishedDownloads.Interval = _configService.CheckForFinishedDownloadInterval;
_scheduledTaskRepository.UpdateMany(new List<ScheduledTask> { rss, downloadedMovies, netImport, checkForFinishedDownloads });
}
}
}

@ -43,6 +43,18 @@
</div>
</div>
</div>
<div class="form-group advanced-settings">
<label class="col-sm-3 control-label">Check For Finished Downloads Interval</label>
<div class="col-sm-1 col-sm-push-2 help-inline">
<i class="icon-radarr-form-info" title="Interval in minutes to query the download clients for finished downloads"/>
</div>
<div class="col-sm-2 col-sm-pull-1">
<input type="number" name="checkForFinishedDownloadInterval" class="form-control" />
</div>
</div>
</div>
</fieldset>

Loading…
Cancel
Save