mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-01-15 17:28:26 -05:00
20 lines
663 B
C#
20 lines
663 B
C#
using Executable.Jobs;
|
|
using Quartz;
|
|
|
|
namespace Executable.DependencyInjection;
|
|
|
|
public static class QuartzDI
|
|
{
|
|
public static IServiceCollection AddQuartzServices(this IServiceCollection services, IConfiguration configuration) =>
|
|
services
|
|
.AddQuartz()
|
|
.AddQuartzHostedService(opt =>
|
|
{
|
|
opt.WaitForJobsToComplete = true;
|
|
})
|
|
// Register BackgroundJobManager as a hosted service
|
|
.AddSingleton<BackgroundJobManager>()
|
|
.AddHostedService(provider => provider.GetRequiredService<BackgroundJobManager>());
|
|
|
|
// Jobs are now managed by BackgroundJobManager
|
|
} |