Celery(异步任务)(续)
periodic_tasks_data = [
{
'task': send_daily_digest,
'name': 'Send daily digest emails',
# 每天早上 9 点
# https://crontab.guru/#0_9_*_*_*
'cron': {
'minute': '0',
'hour': '9',
'day_of_week': '*',
'day_of_month': '*',
'month_of_year': '*',
},
'enabled': True
},
{
'task': cleanup_old_sessions,
'name': 'Cleanup old sessions',
# 每周日凌晨 2 点
# https://crontab.guru/#0_2_*_*_0
'cron': {
'minute': '0',
'hour': '2',
'day_of_week': '0',
'day_of_month': '*',
'month_of_year': '*',
},
'enabled': True
},
{
'task': generate_monthly_report,
'name': 'Generate monthly reports',
# 每月1号早上 6 点
# https://crontab.guru/#0_6_1_*_*
'cron': {
'minute': '0',
'hour': '6',