python – django celery只调用2个apply_async任务中的1个
作者:互联网
我需要调用以下2个apply_async任务:
escalate.apply_async((e.id), countdown=3)
escalate.apply_async((e.id), countdown=3)
我的任务实现如下:
@app.task
def escalate(id, group):
escalation_email, created = EscalationEmail.objects.get_or_create()
escalation_email.send()
return 'sup email sent'
我使用以下命令运行工作:
celery -A proj worker -l info --concurrency=10
问题是,当我看到工人时,只收到1个任务,然后只有1个成功.此外,只有1封电子邮件发送.
似乎大多数时候第二个升级任务都在运行.
如何确保这些任务在100%的时间内可靠地发射?
解决方法:
问题是我没有选择一个队列来关联任务.
标签:python,django,celery,django-celery 来源: https://codeday.me/bug/20190711/1431171.html