From 0aac6cff224166f84e89d149e3956ef6da7ccaa5 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 29 Apr 2019 15:55:39 +1200 Subject: [PATCH] tasks: disable broker heartbeat to workaround connection issues I have been seeing repeated emailed errors from Django reporting "ConnectionResetError: [Errno 104] Connection reset by peer" in the call to get task status i.e: File "/opt/layerindex/layerindex/views.py" in task_log_view 1572. if result.ready(): Digging around this seems to be some sort of known bug: https://github.com/celery/celery/issues/4817 https://github.com/celery/celery/issues/4980 The workaround suggested is to disable the broker heartbeat, so try that in order to avoid the errors. Signed-off-by: Paul Eggleton --- layerindex/tasks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layerindex/tasks.py b/layerindex/tasks.py index 8339b5f..2ad376b 100644 --- a/layerindex/tasks.py +++ b/layerindex/tasks.py @@ -23,7 +23,8 @@ except ImportError: tasks = Celery('layerindex', broker=settings.RABBIT_BROKER, - backend=settings.RABBIT_BACKEND) + backend=settings.RABBIT_BACKEND, + broker_heartbeat=0) @tasks.task def send_email(subject, text_content, from_email=settings.DEFAULT_FROM_EMAIL, to_emails=[]):