Skip to content

Commit 7a8a633

Browse files
committed
Fix/workaround neo4j routing table never being fresh
1 parent 9b05222 commit 7a8a633

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/core/database/cypher.factory.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,13 @@ export const CypherFactory: FactoryProvider<Connection> = {
6666
logger: ILogger,
6767
driverLogger: ILogger,
6868
) => {
69-
const { url, username, password, database, driverConfig } = config.neo4j;
69+
const {
70+
url,
71+
username,
72+
password,
73+
database: databaseNameFromConfig,
74+
driverConfig,
75+
} = config.neo4j;
7076

7177
const driverLoggerAdapter: LoggerFunction = (neoLevel, message) => {
7278
const level =
@@ -148,8 +154,13 @@ export const CypherFactory: FactoryProvider<Connection> = {
148154
if (!this.open) {
149155
return null;
150156
}
157+
158+
// Assume the default name to workaround routing table cache bug.
159+
// https://github.com/neo4j/neo4j-javascript-driver/issues/1138
160+
const resolvedDatabaseName = databaseNameFromConfig || 'neo4j';
161+
151162
const session = this.driver.session({
152-
database,
163+
database: resolvedDatabaseName,
153164
});
154165

155166
session.run = wrapQueryRun(session, logger, parameterTransformer);

0 commit comments

Comments
 (0)