Jobs now use Timespan rather than integer to represent minutes.

pull/3113/head
kay.one 13 years ago
parent 624b6e5acb
commit e358ad6d87

@ -250,7 +250,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
//assert
var timers = jobProvider.All();
timers.Should().HaveCount(1);
timers[0].Interval.Should().Be(fakeJob.DefaultInterval);
timers[0].Interval.Should().Be((Int32)fakeJob.DefaultInterval.TotalMinutes);
timers[0].Name.Should().Be(fakeJob.Name);
timers[0].TypeName.Should().Be(fakeJob.GetType().ToString());
timers[0].LastExecution.Should().HaveYear(DateTime.Now.Year);
@ -354,7 +354,7 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
registeredJobs.Should().HaveCount(1);
registeredJobs.First().TypeName.Should().Be(fakeJob.GetType().ToString());
registeredJobs.First().Name.Should().Be(fakeJob.Name);
registeredJobs.First().Interval.Should().Be(fakeJob.DefaultInterval);
registeredJobs.First().Interval.Should().Be((Int32)fakeJob.DefaultInterval.TotalMinutes);
registeredJobs.First().Enable.Should().Be(true);
registeredJobs.First().Success.Should().Be(initialFakeJob.Success);

@ -14,9 +14,9 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
get { return GetType().Name; }
}
public virtual int DefaultInterval
public virtual TimeSpan DefaultInterval
{
get { return 15; }
get { return TimeSpan.FromMinutes(15); }
}
public int ExecutionCount { get; private set; }
@ -36,9 +36,9 @@ namespace NzbDrone.Core.Test.ProviderTests.JobProviderTests
public class DisabledJob : FakeJob
{
public override int DefaultInterval
public override TimeSpan DefaultInterval
{
get { return 0; }
get { return TimeSpan.FromTicks(0); }
}
}

@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using System.Diagnostics;
using System.IO;
using NLog;
@ -39,9 +40,9 @@ namespace NzbDrone.Core.Jobs
get { return "Update Application Job"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 10080; }
get { return TimeSpan.FromDays(2); }
}
public virtual void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using NLog;
using NzbDrone.Core.Model.Notification;
@ -31,9 +32,9 @@ namespace NzbDrone.Core.Jobs
get { return "Backlog Search"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 43200; }
get { return TimeSpan.FromDays(30); }
}
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -40,10 +40,9 @@ namespace NzbDrone.Core.Jobs
get { return "Banner Download"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
//30 days
get { return 43200; }
get { return TimeSpan.FromDays(30); }
}
public virtual void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -30,9 +30,9 @@ namespace NzbDrone.Core.Jobs
get { return "Convert Episode"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 0; }
get { return TimeSpan.FromTicks(0); }
}
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -24,9 +24,9 @@ namespace NzbDrone.Core.Jobs
get { return "Delete Series"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 0; }
get { return TimeSpan.FromTicks(0); }
}
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -32,9 +32,9 @@ namespace NzbDrone.Core.Jobs
get { return "Media File Scan"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 360; }
get { return TimeSpan.FromHours(6); }
}
public virtual void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -26,9 +26,9 @@ namespace NzbDrone.Core.Jobs
get { return "Episode Search"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 0; }
get { return TimeSpan.FromTicks(0); }
}
public virtual void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using NzbDrone.Core.Model.Notification;
namespace NzbDrone.Core.Jobs
@ -17,7 +18,7 @@ namespace NzbDrone.Core.Jobs
/// </summary>
/// <remarks>Setting this value to 0 means the job will not be
/// executed by the schedule and is only triggered manually.</remarks>
int DefaultInterval { get; }
TimeSpan DefaultInterval { get; }
/// <summary>

@ -44,12 +44,12 @@ namespace NzbDrone.Core.Jobs
get { return "New Series Update"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 1; }
get { return TimeSpan.FromMinutes(1); }
}
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId )
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)
{
_attemptedSeries = new List<int>();
ScanSeries(notification);

@ -94,9 +94,9 @@ namespace NzbDrone.Core.Jobs
jobDefinition.LastExecution = DateTime.Now;
}
jobDefinition.Enable = job.DefaultInterval > 0;
jobDefinition.Enable = job.DefaultInterval.TotalSeconds > 0;
jobDefinition.Name = job.Name;
jobDefinition.Interval = job.DefaultInterval;
jobDefinition.Interval = Convert.ToInt32(job.DefaultInterval.TotalMinutes);
SaveDefinition(jobDefinition);
}

@ -34,9 +34,9 @@ namespace NzbDrone.Core.Jobs
get { return "Drop folder monitor"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 1; }
get { return TimeSpan.FromMinutes(1); }
}
public virtual void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -28,9 +28,9 @@ namespace NzbDrone.Core.Jobs
get { return "Recent Backlog Search"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 1440; }
get { return TimeSpan.FromDays(1); }
}
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -32,9 +32,9 @@ namespace NzbDrone.Core.Jobs
get { return "Rename Episode"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 0; }
get { return TimeSpan.FromTicks(0); }
}
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -31,9 +31,9 @@ namespace NzbDrone.Core.Jobs
get { return "Rename Season"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 0; }
get { return TimeSpan.FromTicks(0); }
}
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -31,9 +31,9 @@ namespace NzbDrone.Core.Jobs
get { return "Rename Series"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 0; }
get { return TimeSpan.FromTicks(0); }
}
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -34,9 +34,9 @@ namespace NzbDrone.Core.Jobs
get { return "RSS Sync"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 25; }
get { return TimeSpan.FromMinutes(25); }
}
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -32,9 +32,9 @@ namespace NzbDrone.Core.Jobs
get { return "Season Search"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 0; }
get { return TimeSpan.FromTicks(0); }
}
public virtual void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -24,9 +24,9 @@ namespace NzbDrone.Core.Jobs
get { return "Series Search"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 0; }
get { return TimeSpan.FromTicks(0); }
}
public void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using NzbDrone.Core.Instrumentation;
using NzbDrone.Core.Model.Notification;
@ -18,9 +19,9 @@ namespace NzbDrone.Core.Jobs
get { return "Trim Logs Job"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 1440; }
get { return TimeSpan.FromDays(1); }
}
public virtual void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -36,9 +36,9 @@ namespace NzbDrone.Core.Jobs
get { return "Update Episode Info"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 720; } //12-hours
get { return TimeSpan.FromHours(12); }
}
public virtual void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Core.Providers;
@ -23,9 +24,9 @@ namespace NzbDrone.Core.Jobs
get { return "Update Scene Mappings"; }
}
public int DefaultInterval
public TimeSpan DefaultInterval
{
get { return 720; } //Every 12 hours
get { return TimeSpan.FromHours(12); }
}
public virtual void Start(ProgressNotification notification, int targetId, int secondaryTargetId)

@ -19,9 +19,10 @@
}
}
</text>))
.Sortable(c=>c.OrderBy(col=>col.Add(g=>g.Interval)))
.Render();}
Items currently in queue
<h1>Items currently in queue</h1>
@{Html.Telerik().Grid((IEnumerable<JobQueueItemModel>)ViewData["Queue"]).Name("QueueGrid")
.Columns(c => c.Bound(g => g.Name).Title("Type").Width(100))

Loading…
Cancel
Save