添加celery任务

This commit is contained in:
AKW 2023-12-13 15:27:31 +08:00
parent 1a1775edb4
commit f89c37855b
2 changed files with 11 additions and 8 deletions

View File

@ -0,0 +1,7 @@
from celery import shared_task
@shared_task(name='save_add_contact')
def save_add_contact(*args, **kwargs):
print(args)
print(kwargs)

View File

@ -14,14 +14,10 @@ app.autodiscover_tasks()
# 定时任务的调度列表,用于注册定时任务 # 定时任务的调度列表,用于注册定时任务
app.conf.beat_schedule = { app.conf.beat_schedule = {
'warning_log': { # 'warning_log': {
'task': 'warning_log', # 'task': 'warning_log',
'schedule': timedelta(minutes=1), # 'schedule': timedelta(minutes=1),
}, # },
'check_authorization_task': {
'task': 'check_authorization_task',
'schedule': timedelta(minutes=30),
},
} }
task_routes = { task_routes = {