From 449606f13f4a22216b1f7cbf74b5bc109c845735 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Mon, 7 Oct 2019 09:51:28 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20Tasks=20=E8=A7=86=E5=9B=BE=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E4=B8=8D=E7=94=A8=E7=9A=84=20div=20=E5=85=83=E7=B4=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bootstrap.Admin/Views/Admin/Tasks.cshtml | 47 +++++++++---------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/src/admin/Bootstrap.Admin/Views/Admin/Tasks.cshtml b/src/admin/Bootstrap.Admin/Views/Admin/Tasks.cshtml index 7b32d715..f77cfb54 100644 --- a/src/admin/Bootstrap.Admin/Views/Admin/Tasks.cshtml +++ b/src/admin/Bootstrap.Admin/Views/Admin/Tasks.cshtml @@ -20,31 +20,28 @@ } @section query { -
-
-

后台任务说明:

-

1. 默认任务 (立即执行,仅执行一次)

-

- - TaskServicesManager.GetOrAdd("简单任务", token => Task.Delay(1000)); - -

-

2. 周期性任务 (1 分钟后间隔 5 秒执行 2 次任务)

-

- - var trigger = TriggerBuilder.Default.WithInterval(TimeSpan.FromSeconds(5)).WithRepeatCount(2).WithStartTime(DateTimeOffset.Now.AddMinutes(1)).Build(); -
- TaskServicesManager.GetOrAdd("测试任务", token => Task.Delay(1000), trigger); -
-

-

3. Cron 表达式任务 (间隔 5 秒循环执行任务)

-

- - TaskServicesManager.GetOrAdd("Cron 表达式任务", token => Task.Delay(1000), TriggerBuilder.Build("*/5 * * * * *")); - -

-

开源地址: https://gitee.com/LongbowGroup/Longbow.Tasks

-
+
+

后台任务说明:

+

1. 默认任务 (立即执行,仅执行一次)

+

+ + TaskServicesManager.GetOrAdd("简单任务", token => Task.Delay(1000)); + +

+

2. 周期性任务 (1 分钟后间隔 5 秒执行 2 次任务)

+

+ + var trigger = TriggerBuilder.Default.WithInterval(TimeSpan.FromSeconds(5)).WithRepeatCount(2).WithStartTime(DateTimeOffset.Now.AddMinutes(1)).Build(); +
+ TaskServicesManager.GetOrAdd("测试任务", token => Task.Delay(1000), trigger); +
+

+

3. Cron 表达式任务 (间隔 5 秒循环执行任务)

+

+ + TaskServicesManager.GetOrAdd("Cron 表达式任务", token => Task.Delay(1000), TriggerBuilder.Build("*/5 * * * * *")); + +

} @section modal {