Nebula Graph服务出现连接池不够

Nebula Graph服务出现连接池不够,会报NotValidConnectionException,有没有好的解决方案来处理连接池的问题,而不是通过设置最大连接池数。

当前使用方式如下

def connect_nebula(self):
        """数据库连接"""
        config = Config()
        config.max_connection_pool_size = NEBULA_CONNECTION_NUM
        connection_pool = ConnectionPool()
        flag = connection_pool.init([(NEBULA_HOST, NEBULA_PORT)], config)
        if flag:
            print("连接nebula graph成功")
        else:
            raise ("连接nebula graph失败,请检查配置")
        return connection_pool

    def query_nGQL(self, command: str,  database: str):
        """使用Nebula Graph nGQL语句进行查询

        Args:
            command (str): nGQL语句
            database (dict): 数据库schmea

        Returns:
            [type]: [description]
        """
        with self.connection_pool.session_context(NEBULA_USER, NEBULA_PAWD) as session:
            resp = session.execute("use %s" % database)
            logger.info("use database: use %s" % database)
            assert resp.is_succeeded(), resp.error_msg()
            logger.info("nGQL command: %s" % command)
            query_resp = session.execute(command)
            query_parse_list = parse_resp(query_resp)
            return query_parse_list

尝试过使用论坛说的使用队列的方式初始化连接池,但是会出现如果输入存在问题报错,后面的请求不继续服务,或者出现The connection using by someone, but now want to close it

:thinking: 都是老人了,提问记得选对分类,还有补充下你的 Nebula 的版本号。看这个样子,你用的是 python 客户端?

此话题已在最后回复的 30 天后被自动关闭。不再允许新回复。