Skip to content

Commit

Permalink
归档任务时,添加task名称
Browse files Browse the repository at this point in the history
  • Loading branch information
woshiyanghai committed Sep 19, 2024
1 parent 5579f7a commit e6b62fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions archery/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@
Redis:没有相应的机制保证消息的消费,当消费者消费失败的时候,消息体丢失,需要手动处理
RabbitMQ:具有消息消费确认,即使消费者消费失败,也会自动使消息体返回原队列,同时可全程持久化,保证消息体被正确消费
'''
CELERY_RESULT_BACKEND = 'redis://127.0.0.1:6379/1' #必须要存储任务结果,代码中有一些需要判断任务状态
#CELERY_RESULT_BACKEND = 'django-db'
CELERY_RESULT_BACKEND = 'django-db' #必须要存储任务结果,代码中有一些需要判断任务状态
#CELERY_RESULT_BACKEND = 'redis://127.0.0.1:6379/1'
CELERY_BROKER_URL = 'redis://127.0.0.1:6379/2'
CELERY_BEAT_SCHEDULER = 'django_celery_beat.schedulers:DatabaseScheduler'
CELERYD_CONCURRENCY = 4
Expand Down
2 changes: 1 addition & 1 deletion sql/archiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,5 +528,5 @@ def archive_switch(request):
def archive_once(request):
"""单次立即调用归档任务"""
archive_id = request.GET.get("archive_id")
archive.apply_async(args=[archive_id]) # 使用 Celery 的apply_async方法调度任务
archive.apply_async(args=[archive_id],task_id=f"archive-{archive_id}") # 使用 Celery 的apply_async方法调度任务
return JsonResponse({"status": 0, "msg": "ok", "data": {}})

0 comments on commit e6b62fc

Please sign in to comment.