feat: 增加一个 10 秒周期任务
This commit is contained in:
parent
cdcea1571b
commit
02ed7d6507
|
@ -37,7 +37,8 @@ namespace Microsoft.Extensions.DependencyInjection
|
|||
protected override Task ExecuteAsync(CancellationToken stoppingToken) => Task.Run(() =>
|
||||
{
|
||||
TaskServicesManager.GetOrAdd("单次任务", token => Task.Delay(1000));
|
||||
TaskServicesManager.GetOrAdd("周期任务", token => Task.Delay(1000), TriggerBuilder.Build(Cron.Secondly(5)));
|
||||
TaskServicesManager.GetOrAdd("周期任务", token => Task.Delay(1000), TriggerBuilder.Default.WithInterval(10000).Build());
|
||||
TaskServicesManager.GetOrAdd("Cron 任务", token => Task.Delay(1000), TriggerBuilder.Build(Cron.Secondly(5)));
|
||||
TaskServicesManager.GetOrAdd("超时任务", token => Task.Delay(2000), TriggerBuilder.Default.WithTimeout(1000).WithInterval(1000).WithRepeatCount(2).Build());
|
||||
|
||||
// 本机调试时此处会抛出异常,配置文件中默认开启了任务持久化到物理文件,此处异常只有首次加载时会抛出
|
||||
|
|
Loading…
Reference in New Issue