计划任务修改,act与kv使用协程方式执行,不影响其他任务

This commit is contained in:
ayflying
2025-09-01 18:12:58 +08:00
parent 95539038c0
commit 50cfc23ad2
6 changed files with 31 additions and 12 deletions

View File

@@ -60,7 +60,7 @@ type sSystemCron struct {
func New() *sSystemCron {
return &sSystemCron{
taskChan: make(chan func(context.Context) error, 2),
TaskTimeout: time.Minute * 30,
TaskTimeout: time.Minute * 60,
}
}
@@ -333,7 +333,7 @@ func (s *sSystemCron) RunFuncChan() {
//ctx := gctx.New()
func() {
//超时释放资源
ctx, cancel := context.WithTimeout(context.Background(), s.TaskTimeout)
ctx, cancel := context.WithTimeout(gctx.New(), s.TaskTimeout)
defer cancel()
// 使用匿名函数包裹来捕获 panic