首页 > 解决方案 > [标签:芹菜 [连接重置错误,由于“与代理的连接”丢失或无法接收确认

问题描述

我有一个名为 task_conclude_key_issues_through_selenium 的后台任务,它将在网页上执行一些点击操作,大约需要 3 到 5 分钟。

一旦芹菜后台任务执行完成,我就会收到以下任何错误。

1.[2020-10-26 16:14:45,233:警告/MainProcess] 消费者:与代理的连接丢失。正在尝试重新建立连接... Traceback (last last call last) 2.Couldn't ack 2, reason:ConnectionResetError(10054, "An existing connection was强制关闭远程主机', None, 10054, None)

2 到 3 分钟后,它连接到代理并显示以下日志消息 ConnectionResetError: [WinError 10054] 远程主机强制关闭现有连接 [2020-10-26 16:23:07,677: INFO/MainProcess] Connected to amqp ://guest:**@127.0.0.1:5672//

views.py:
--------
board_details_task_info = task_conclude_key_issues_through_selenium.apply_async(args=[created_pk])

tasks.py:
--------
@shared_task(bind=True)
def task_conclude_key_issues_through_selenium(self, created_pk):
     
settings.py:
-----------
CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672//'

CELERY_RESULT_BACKEND = 'django-db'

CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TRACK_STARTED=True

我的应用程序使用以下包: 1.celery - 5.0.1 2.celery_progress 3.Python - 3.6.2

请让我们知道如何解决这些错误并继续进行。

问候,N.Dilip kumar。

标签: djangocelery

解决方案


此问题已通过升级 celery 和 django_celery_results 软件包的安装得到解决。安装了最新版本的 celery 和 django_celery_results。1.django_celery_results==1.2.1 2.Celery==4.4.7


推荐阅读