执行持久化的计划任务,有一个打断机制

This commit is contained in:
ayflying
2025-08-22 11:46:24 +08:00
parent 14cf759ce1
commit f1c22dc9e6
3 changed files with 32 additions and 21 deletions

View File

@@ -2,6 +2,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"
@@ -16,8 +17,8 @@ func Boot() (err error) {
// 启动计划任务定时器预防debug工具激活计划任务造成重复执行此处不执行计划任务
//err = service.SystemCron().StartCron()
//用户活动持久化
service.SystemCron().AddCronV2(v1.CronType_DAILY, func(ctx context.Context) error {
//用户活动持久化每小时执行一次
service.SystemCron().AddCronV2(v1.CronType_HOUR, func(ctx context.Context) error {
err = service.GameKv().SavesV1()
err = service.GameAct().Saves(ctx)
return err