Timeout on Neo4J-Javascript driver

478 Views Asked by At

How to avoid that neo4j-javascript-driver Node.Js module quits on timeout?

I'm getting this error:

Neo4jError: Operation timed out in 60000 ms

And I don't want this time out to be in place.

1

There are 1 best solutions below

0
Sophia On

You can define your own timeout, like so:

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
});