将task拆分为cron与task两部分,使其呈现父子结构,切单独可控。

This commit is contained in:
piexlmax(奇淼
2023-12-22 09:55:57 +08:00
parent 90f19679e7
commit 5cd33814fc
2 changed files with 103 additions and 74 deletions
+3 -3
View File
@@ -28,7 +28,7 @@ func TestNewTimerTask(t *testing.T) {
{
_, err := tm.AddTaskByFunc("func", "@every 1s", mockFunc, "测试mockfunc")
assert.Nil(t, err)
_, ok := _tm.taskList["func"]
_, ok := _tm.cronList["func"]
if !ok {
t.Error("no find func")
}
@@ -37,7 +37,7 @@ func TestNewTimerTask(t *testing.T) {
{
_, err := tm.AddTaskByJob("job", "@every 1s", job, "测试job mockfunc")
assert.Nil(t, err)
_, ok := _tm.taskList["job"]
_, ok := _tm.cronList["job"]
if !ok {
t.Error("no find job")
}
@@ -65,7 +65,7 @@ func TestNewTimerTask(t *testing.T) {
}
}
{
a := tm.FindTaskList()
a := tm.FindCronList()
b, c := tm.FindCron("job")
fmt.Println(a, b, c)
}