Files
epic-go/manifest/config/cron.yaml
hu xiaotong cecb19e497 feat(cron): 实现定时任务管理功能
- 新增 cron模块,支持定时任务管理- 实现了任务列表获取、任务添加、任务移除和任务状态获取等接口
- 添加了默认任务,包括数据同步、数据清理、健康检查和缓存刷新等
- 实现了优雅关闭功能,确保在服务停止时正确停止所有任务
- 添加了定时任务相关文档和使用指南
2025-06-23 15:19:38 +08:00

44 lines
1.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 定时任务配置
cron:
# 是否启用定时任务
enabled: true
# 默认任务配置
jobs:
# 数据同步任务 - 每小时执行一次
data_sync_hourly:
enabled: true
cron: "0 * * * *"
description: "每小时从第三方网站同步数据"
# 数据清理任务 - 每天凌晨2点执行
data_cleanup_daily:
enabled: true
cron: "0 2 * * *"
description: "每天清理过期数据"
# 健康检查任务 - 每5分钟执行一次
health_check:
enabled: true
cron: "*/5 * * * *"
description: "系统健康检查"
# 缓存刷新任务 - 每30分钟执行一次
cache_refresh:
enabled: true
cron: "*/30 * * * *"
description: "刷新系统缓存"
# 任务执行配置
execution:
# 最大并发任务数
max_concurrent: 10
# 任务超时时间
timeout: 300
# 失败重试次数
retry_count: 3
# 重试间隔
retry_interval: 60