Celery + SQLAlchemy:DatabaseError:(DatabaseError)SSL错误:解密失败或错误的记录mac [英] Celery + SQLAlchemy : DatabaseError: (DatabaseError) SSL error: decryption failed or bad record mac
问题描述
我在烧瓶+ SQLAlchemy配置
正如这里提到的: https://github.com/celery/celery/issues/634
django-celery插件的解决方案只是简单地在任务开始时处理所有数据库连接。
在flask + SQLAlchemy配置中,这样做对我很有用:
from celery.signals import task_prerun
@ task_prerun.connect
def on_task_init(* args,** kwargs):
engine.dispose()
如果您不知道引擎是什么以及如何获取它,请参阅: http://flask.pocoo.org/docs/patterns/sqlalchemy/
Error in the title triggers sometimes when using celery with more than one worker on a postgresql db with SSL turned on. I'm in a flask + SQLAlchemy configuration
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/
这篇关于Celery + SQLAlchemy:DatabaseError:(DatabaseError)SSL错误:解密失败或错误的记录mac的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!