1

如何避免neo4j-javascript-driverNode.Js 模块超时退出?

我收到此错误:

Neo4jError: Operation timed out in 60000 ms

而且我不希望这个时间到位。

4

1 回答 1

0

您可以定义自己的超时时间,如下所示:

import Neo4j from "neo4j-driver";

// create driver
const driver = Neo4j.driver(`bolt://host:port`, Neo4j.auth.basic(user, password),{
    encrypted: 'ENCRYPTION_OFF',
    maxConnectionLifetime: 3 * 60 * 60 * 1000, // 3 hours
    maxConnectionPoolSize: 150
});

// create session
const s = driver.session();

// transaction
r = await s.writeTransaction(tx => f(tx), {
    timeout: 99999999 // define timeout
});
于 2020-10-28T14:30:45.577 回答