helpers.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:Sentry 作者: NetEaseGame 项目源码 文件源码
def can_reconnect(exc):
    if isinstance(exc, psycopg2.InterfaceError):
        return True
    # elif isinstance(exc, psycopg2.OperationalError):
    #     exc_msg = str(exc)
    #     if "can't fetch default_isolation_level" in exc_msg:
    #         return True
    #     elif "can't set datestyle to ISO" in exc_msg:
    #         return True
    #     return True
    elif isinstance(exc, DatabaseError):
        exc_msg = str(exc)
        if 'server closed the connection unexpectedly' in exc_msg:
            return True
        elif 'client_idle_timeout' in exc_msg:
            return True
    return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号