修复定时任务功能

This commit is contained in:
junleea 2024-11-06 21:20:12 +08:00
parent d9e622e37b
commit 66ec0ff947
1 changed files with 2 additions and 2 deletions

View File

@ -233,6 +233,7 @@ func RunCron() {
//如果没有定时任务查找数据库是否有定时任务如果有则加入redis如果没有则不做任何操作
key := "cron_cid_runs"
res := worker.GetRedis(key)
fmt.Println("cid run cron res:", res)
if res == "" {
cids := dao.FindCIDByTime()
cid_workers := make([]proto.CIDRUN, 0)
@ -250,8 +251,7 @@ func RunCron() {
}
} else {
var cid_workers []proto.CIDRUN
cid_redis_workers := worker.GetRedis(key)
err := json.Unmarshal([]byte(cid_redis_workers), &cid_workers)
err := json.Unmarshal([]byte(res), &cid_workers)
if err != nil {
fmt.Println("json unmarshal failed")
}