mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
Added NextScheduledRun to get the next scheduled run for a job, with a test.
This commit is contained in:
parent
d4c9e5d12f
commit
fdd6e37b24
4 changed files with 32 additions and 11 deletions
|
@ -78,7 +78,6 @@ namespace NzbDrone.Core.Providers.Jobs
|
|||
|
||||
try
|
||||
{
|
||||
|
||||
var pendingJobs = All().Where(
|
||||
t => t.Enable &&
|
||||
(DateTime.Now - t.LastExecution) > TimeSpan.FromMinutes(t.Interval)
|
||||
|
@ -218,6 +217,19 @@ namespace NzbDrone.Core.Providers.Jobs
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the next scheduled run time for the job
|
||||
/// (Estimated due to schedule timer)
|
||||
/// </summary>
|
||||
/// <returns>DateTime of next scheduled job</returns>
|
||||
public virtual DateTime NextScheduledRun(Type jobType)
|
||||
{
|
||||
var job = All().Where(t => t.TypeName == jobType.ToString()).FirstOrDefault();
|
||||
|
||||
if (job == null)
|
||||
return DateTime.Now;
|
||||
|
||||
return job.LastExecution.AddMinutes(job.Interval);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue