3 Star 2 Fork 1

fotomxq/weeekj_core

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
run.go 993 Bytes
一键复制 编辑 原始数据 按行查看 历史
fotomxq 提交于 2025-02-05 18:52 +08:00 . 修改项目路径;
package AnalysisUserVisit
import (
CoreLog "gitee.com/fotomxq/weeekj_core/v5/core/log"
CoreSystemClose "gitee.com/fotomxq/weeekj_core/v5/core/system_close"
"github.com/robfig/cron"
"time"
)
func Run() {
//捕捉异常
defer func() {
if r := recover(); r != nil {
CoreLog.Error("analysis user visit run, ", r)
}
runTimer.Stop()
}()
//等待
time.Sleep(time.Second * 60)
//启动定时器
runTimer = cron.New()
if err := runTimer.AddFunc("0 0 * * * *", func() {
if runAnalysisLock {
return
}
runAnalysisLock = true
runAnalysis()
runAnalysisLock = false
}); err != nil {
CoreLog.Error("analysis user visit run, cron time, ", err)
}
if err := runTimer.AddFunc("0 15 2 * * *", func() {
if runExpireLock {
return
}
runExpireLock = true
runExpire()
runExpireLock = false
}); err != nil {
CoreLog.Error("analysis user visit run, cron time, ", err)
}
runTimer.Start()
//卡住进程
CoreSystemClose.Wait()
//退出时间
runTimer.Stop()
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/fotomxq/weeekj_core.git
git@gitee.com:fotomxq/weeekj_core.git
fotomxq
weeekj_core
weeekj_core
v5.3.83

搜索帮助