lnshi/node-cayley

nodejs.TypeError: cayley_clients.pickRandomly is not a function

haibinpark opened this issue · 1 comments

我通过以下代码,去获取cayley_client的连接出错。

        const cayley_clients = require('node-cayley')({
            promisify: true,
            servers: [
                {
                    host: app.config.cayleydb.host,
                    port: app.config.cayleydb.port
                }
            ]
        });
        this.cayley_client = cayley_clients.pickRandomly();
lnshi commented

@haibinpark

文档这里提到了:如果提供的配置是单个server,会直接返回一个连接实例的。

If single cayley host is provided, the lib will return one single client directly.

If multiple cayley hosts are provided, the lib will return a clients array plus a default random client selection strategy which is named as pickRandomly, you can just use it as:

欢迎多提问题,多增加些test case。