🐛 Fix last active task didn't set up

This commit is contained in:
LittleSheep 2025-06-07 16:51:51 +08:00
parent b1c12685c8
commit b69dd659d4

View File

@ -261,6 +261,17 @@ builder.Services.AddQuartz(q =>
.WithIntervalInSeconds(60)
.RepeatForever())
);
var lastActiveFlushJob = new JobKey("LastActiveFlush");
q.AddJob<LastActiveFlushJob>(opts => opts.WithIdentity(lastActiveFlushJob));
q.AddTrigger(opts => opts
.ForJob(lastActiveFlushJob)
.WithIdentity("LastActiveFlushTrigger")
.WithSimpleSchedule(o => o
.WithIntervalInMinutes(5)
.RepeatForever())
);
});
builder.Services.AddQuartzHostedService(q => q.WaitForJobsToComplete = true);