Celery + SQLAlchemy : DatabaseError: (DatabaseError) SSL error: decryption failed or bad record mac

只谈情不闲聊 提交于 2019-12-06 03:05:40

As mentionned here : https://github.com/celery/celery/issues/634 the solution in the django-celery plugin was to simply dispose all db connection at the start of the task.

In flask + SQLAlchemy configuration, doing this worked for me :

from celery.signals import task_prerun

@task_prerun.connect
def on_task_init(*args, **kwargs):
    engine.dispose()

in case you don't know what "engine" is and how to get it, see here : http://flask.pocoo.org/docs/patterns/sqlalchemy/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!