Celery + SQLAlchemy:DatabaseError:(DatabaseError)SSL错误:解密失败或错误的记录mac [英] Celery + SQLAlchemy : DatabaseError: (DatabaseError) SSL error: decryption failed or bad record mac

查看:353
本文介绍了Celery + SQLAlchemy:DatabaseError:(DatabaseError)SSL错误:解密失败或错误的记录mac的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在带有SSL的postgresql数据库上使用芹菜和多个工作人员时,标题中的错误有时会触发。
我在烧瓶+ 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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆