// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHangfireServer(); app.UseHangfireDashboard(); app.UseMvc(); // We want to keep sync setup in the Sync Manager, // but want to ensure it's scheduling code is called as soon as the app starts up using (var scope = app.ApplicationServices.GetService <IServiceScopeFactory>().CreateScope()) { var syncManager = scope.ServiceProvider.GetRequiredService <JobMgr>(); JobMgr.ScheduleTasks(); } }
public JobsController(ILogger <JobsController> logger, JobMgr jobMgr) { _logger = logger; _jobMgr = jobMgr; }