refactor: replace QuartzHostedService with QuartzServer and remove unnecessary using
- Replaced `AddQuartzHostedService` with `AddQuartzServer` for better Quartz integration. - Removed `Microsoft.Extensions.Options` using as it was unused. - Updated Quartz job naming to remove GUID and simplify identity. - Minor code cleanup in using statements and regions.
This commit is contained in:
@@ -5,8 +5,8 @@ using EnvelopeGenerator.Finalizer.Models;
|
||||
using EnvelopeGenerator.Infrastructure;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Quartz;
|
||||
using Quartz.AspNetCore;
|
||||
using Serilog;
|
||||
|
||||
// Load Serilog from appsettings.json
|
||||
@@ -43,10 +43,10 @@ try
|
||||
builder.Services.AddSwaggerGen();
|
||||
#endregion
|
||||
|
||||
#region Worker
|
||||
#region AQuartz
|
||||
builder.Services.AddQuartz(q =>
|
||||
{
|
||||
var name = $"{typeof(Worker).FullName}-{Guid.NewGuid():N}";
|
||||
var name = $"{typeof(Worker).FullName}";
|
||||
var jobKey = new JobKey(name);
|
||||
q.AddJob<Worker>(opts => opts.WithIdentity(jobKey));
|
||||
|
||||
@@ -63,9 +63,9 @@ try
|
||||
.WithCronSchedule(expression));
|
||||
});
|
||||
|
||||
builder.Services.AddQuartzHostedService(opt =>
|
||||
builder.Services.AddQuartzServer(options =>
|
||||
{
|
||||
opt.WaitForJobsToComplete = true;
|
||||
options.WaitForJobsToComplete = true;
|
||||
});
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user