From 03432faf374e07584f290c78e9cb497dd5d472e5 Mon Sep 17 00:00:00 2001 From: Demis Bellot Date: Sun, 18 Aug 2024 18:16:53 +0800 Subject: [PATCH] touch --- MyApp/Configure.BackgroundJobs.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/MyApp/Configure.BackgroundJobs.cs b/MyApp/Configure.BackgroundJobs.cs index 6f1b6a7..af96b21 100644 --- a/MyApp/Configure.BackgroundJobs.cs +++ b/MyApp/Configure.BackgroundJobs.cs @@ -15,11 +15,14 @@ public void Configure(IWebHostBuilder builder) => builder services.AddPlugin(new CommandsFeature()); services.AddPlugin(new BackgroundsJobFeature()); services.AddHostedService(); - }).ConfigureAppHost(afterAppHostInit:appHost => - { - var jobs = appHost.Resolve(); + }).ConfigureAppHost(afterAppHostInit:appHost => { + + var services = appHost.GetApplicationServices(); + var jobs = services.GetRequiredService(); - jobs.RecurringCommand("Every Minute", Schedule.EveryMinute); + jobs.RecurringCommand("Every Minute", Schedule.EveryMinute, new() { + RunCommand = true // don't persist job + }); jobs.RecurringCommand("Every 8 hours", Schedule.Interval(TimeSpan.FromHours(8)), new SendEmail