Start the scheduler after the jobs have been assigned

This commit is contained in:
tidusjar 2019-04-24 10:27:15 +01:00
parent ad6c72f12a
commit 27a7e96f75
3 changed files with 7 additions and 5 deletions

View file

@ -181,7 +181,7 @@ namespace Ombi.DependencyInjection
public static void RegisterJobs(this IServiceCollection services) public static void RegisterJobs(this IServiceCollection services)
{ {
services.AddTransient<IJobFactory, IoCJobFactory>(provider => new IoCJobFactory(provider)); services.AddSingleton<IJobFactory, IoCJobFactory>(provider => new IoCJobFactory(provider));
services.AddTransient<IBackgroundJobClient, BackgroundJobClient>(); services.AddTransient<IBackgroundJobClient, BackgroundJobClient>();
services.AddTransient<IPlexContentSync, PlexContentSync>(); services.AddTransient<IPlexContentSync, PlexContentSync>();

View file

@ -60,7 +60,10 @@ namespace Ombi.Schedule
{ {
ITrigger jobTrigger = TriggerBuilder.Create() ITrigger jobTrigger = TriggerBuilder.Create()
.WithIdentity(name + "Trigger", group) .WithIdentity(name + "Trigger", group)
.WithCronSchedule(cronExpression) .WithCronSchedule(cronExpression,
x => x.WithMisfireHandlingInstructionFireAndProceed())
.ForJob(name, group)
.StartNow()
.Build(); .Build();
await Scheduler.ScheduleJob(job, jobTrigger); await Scheduler.ScheduleJob(job, jobTrigger);
} }

View file

@ -48,15 +48,14 @@ namespace Ombi.Schedule
// Set job factory // Set job factory
OmbiQuartz.Instance.UseJobFactory(jobFactory); OmbiQuartz.Instance.UseJobFactory(jobFactory);
// Run Quartz
await OmbiQuartz.Start();
// Run configuration // Run configuration
await AddPlex(s); await AddPlex(s);
await AddEmby(s); await AddEmby(s);
await AddDvrApps(s); await AddDvrApps(s);
await AddSystem(s); await AddSystem(s);
// Run Quartz
await OmbiQuartz.Start();
} }
private static async Task AddSystem(JobSettings s) private static async Task AddSystem(JobSettings s)