You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
556 B
17 lines
556 B
using Hangfire;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Volo.Abp;
|
|
|
|
namespace CompanyName.ProjectName.Jobs
|
|
{
|
|
public static class RecurringJobsExtensions
|
|
{
|
|
public static void CreateRecurringJob(this ApplicationInitializationContext context)
|
|
{
|
|
using var scope = context.ServiceProvider.CreateScope();
|
|
var testJob =
|
|
scope.ServiceProvider.GetService<TestJob>();
|
|
RecurringJob.AddOrUpdate("测试Job", () => testJob.ExecuteAsync(), CronType.Minute(1));
|
|
}
|
|
}
|
|
}
|