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 <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2019-04-29 15:55:39 +12:00
parent 22133f74d0
commit 0aac6cff22

View File

@ -23,7 +23,8 @@ except ImportError:
tasks = Celery('layerindex', tasks = Celery('layerindex',
broker=settings.RABBIT_BROKER, broker=settings.RABBIT_BROKER,
backend=settings.RABBIT_BACKEND) backend=settings.RABBIT_BACKEND,
broker_heartbeat=0)
@tasks.task @tasks.task
def send_email(subject, text_content, from_email=settings.DEFAULT_FROM_EMAIL, to_emails=[]): def send_email(subject, text_content, from_email=settings.DEFAULT_FROM_EMAIL, to_emails=[]):