-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
109 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/backend/NetAdmin/NetAdmin.Infrastructure/Schedule/IJob.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace NetAdmin.Infrastructure.Schedule; | ||
|
||
/// <summary> | ||
/// 作业处理程序 | ||
/// </summary> | ||
public interface IJob | ||
{ | ||
/// <summary> | ||
/// 具体处理逻辑 | ||
/// </summary> | ||
Task ExecuteAsync(CancellationToken cancelToken); | ||
} |
23 changes: 23 additions & 0 deletions
23
src/backend/NetAdmin/NetAdmin.Infrastructure/Schedule/JobConfigAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace NetAdmin.Infrastructure.Schedule; | ||
|
||
/// <summary> | ||
/// 作业配置 | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Class)] | ||
public sealed class JobConfigAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// 上一次执行时间 | ||
/// </summary> | ||
public DateTime? LastExecutionTime { get; set; } | ||
|
||
/// <summary> | ||
/// 启动时运行 | ||
/// </summary> | ||
public bool RunOnStart { get; init; } | ||
|
||
/// <summary> | ||
/// 触发器表达式 | ||
/// </summary> | ||
public string TriggerCron { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters