111
This commit is contained in:
@@ -88,12 +88,24 @@ class Timer {
|
||||
//Cron字符串
|
||||
local NextTimestep = Info[2];
|
||||
//执行函数
|
||||
func.acall(func_args);
|
||||
local Flag = func.acall(func_args);
|
||||
//继续构建下一次任务
|
||||
Date_Exec_Tree.insert(Sq_Cron_Next(NextTimestep, time()), Info);
|
||||
if(Flag == null || Flag == true) Date_Exec_Tree.insert(Sq_Cron_Next(NextTimestep, time()), Info, Node.name);
|
||||
}
|
||||
|
||||
function SetCronTask(target_func, CronString, ...) {
|
||||
function SetCronTask(target_func, build_info, ...) {
|
||||
local CronString = "";
|
||||
local TaskName = null;
|
||||
//如果是字符串直接就是Cron字符串
|
||||
if (typeof build_info == "string") {
|
||||
CronString = build_info;
|
||||
}
|
||||
//如果是Table 则有名字
|
||||
else if (typeof build_info == "table") {
|
||||
CronString = build_info.Cron;
|
||||
TaskName = build_info.Name;
|
||||
}
|
||||
|
||||
local NowTimestep = time();
|
||||
|
||||
//下一次执行的时间
|
||||
@@ -115,7 +127,11 @@ class Timer {
|
||||
//间隔时间戳时间
|
||||
func_info.push(CronString);
|
||||
|
||||
_Timer_Object.Date_Exec_Tree.insert(NextTimestep, func_info);
|
||||
_Timer_Object.Date_Exec_Tree.insert(NextTimestep, func_info, TaskName);
|
||||
}
|
||||
|
||||
function RemoveCronTask(name) {
|
||||
_Timer_Object.Date_Exec_Tree.removeNodeByName(name);
|
||||
}
|
||||
|
||||
function Update() {
|
||||
|
||||
Reference in New Issue
Block a user