mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-28 02:37:40 +00:00
26 lines
No EOL
670 B
C#
26 lines
No EOL
670 B
C#
using System.Timers;
|
|
using NzbDrone.Common.Eventing;
|
|
using NzbDrone.Core.Lifecycle;
|
|
|
|
namespace NzbDrone.Core.Jobs
|
|
{
|
|
public class JobTimer : IHandle<ApplicationStartedEvent>
|
|
{
|
|
private readonly IJobController _jobController;
|
|
private readonly Timer _timer;
|
|
|
|
public JobTimer(IJobController jobController)
|
|
{
|
|
_jobController = jobController;
|
|
_timer = new Timer();
|
|
|
|
}
|
|
|
|
public void Handle(ApplicationStartedEvent message)
|
|
{
|
|
_timer.Interval = 1000 * 30;
|
|
_timer.Elapsed += (o, args) => _jobController.EnqueueScheduled();
|
|
_timer.Start();
|
|
}
|
|
}
|
|
} |