fix(recruitment): gcron 表达式改 6 段式,修复每日抓取/推送任务从未注册

gcron 不支持 5 段标准 cron,'0 3 * * *'/'0 8 * * *' 注册时报 invalid pattern
被 ERRO 日志吞掉,导致线上每日 03:00 增量抓取与 08:00 招聘早报推送从未执行。
改为 '0 0 3 * * *' / '0 0 8 * * *'。
This commit is contained in:
夏犀麟 2026-08-27 10:50:23 +08:00
parent 8721d01028
commit f81ce64fdd

View File

@ -9,8 +9,9 @@ import (
// StartScheduler 注册定时任务:每日 03:00 增量抓取全部启用源08:00 推送招聘早报。
// 调度器随 service 进程常驻,不额外引入系统 crontab。
// 注意gcron 表达式为 6 段式(秒 分 时 日 月 周5 段标准 cron 会注册失败。
func StartScheduler(ctx context.Context) {
if _, err := gcron.Add(ctx, "0 3 * * *", func(c context.Context) {
if _, err := gcron.Add(ctx, "0 0 3 * * *", func(c context.Context) {
_, summary, e := Recruitment().Trigger(c, 0, false)
if e != nil {
g.Log().Errorf(c, "recruit daily crawl failed: %v", e)
@ -20,7 +21,7 @@ func StartScheduler(ctx context.Context) {
}, "recruit-crawl-daily"); err != nil {
g.Log().Errorf(ctx, "add recruit crawl cron failed: %v", err)
}
if _, err := gcron.Add(ctx, "0 8 * * *", func(c context.Context) {
if _, err := gcron.Add(ctx, "0 0 8 * * *", func(c context.Context) {
sendDailyDigest(c)
}, "recruit-push-daily"); err != nil {
g.Log().Errorf(ctx, "add recruit push cron failed: %v", err)