Skip to content

Commit

Permalink
touch
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Aug 18, 2024
1 parent 741aace commit 03432fa
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions MyApp/Configure.BackgroundJobs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ public void Configure(IWebHostBuilder builder) => builder
services.AddPlugin(new CommandsFeature());
services.AddPlugin(new BackgroundsJobFeature());
services.AddHostedService<JobsHostedService>();
}).ConfigureAppHost(afterAppHostInit:appHost =>
{
var jobs = appHost.Resolve<IBackgroundJobs>();
}).ConfigureAppHost(afterAppHostInit:appHost => {
var services = appHost.GetApplicationServices();
var jobs = services.GetRequiredService<IBackgroundJobs>();
jobs.RecurringCommand<LogCommand>("Every Minute", Schedule.EveryMinute);
jobs.RecurringCommand<LogCommand>("Every Minute", Schedule.EveryMinute, new() {
RunCommand = true // don't persist job
});
jobs.RecurringCommand<SendEmailCommand>("Every 8 hours", Schedule.Interval(TimeSpan.FromHours(8)),
new SendEmail
Expand Down

0 comments on commit 03432fa

Please sign in to comment.