增加计划任务的打断机制

This commit is contained in:
ayflying
2025-04-22 12:15:53 +08:00
parent d6bfe1c2fb
commit 569937c67f
5 changed files with 75 additions and 38 deletions

View File

@@ -1,6 +1,7 @@
package boot
import (
"context"
v1 "github.com/ayflying/utility_go/api/system/v1"
"github.com/ayflying/utility_go/service"
"github.com/gogf/gf/v2/os/gctx"
@@ -15,15 +16,14 @@ func Boot() (err error) {
err = service.SystemCron().StartCron()
//用户活动持久化
service.SystemCron().AddCron(v1.CronType_DAILY, func() error {
return service.GameAct().Saves()
service.SystemCron().AddCronV2(v1.CronType_DAILY, func(ctx context.Context) error {
return service.GameAct().Saves(ctx)
})
//初始化自启动方法
for _, v := range _func {
v()
}
return nil
}