Open StefanoDeVuono opened 7 years ago
I've did the same test with the official neo4j driver which leaves an open db connection, too.
const wtf = require('wtfnode');
const neo4j = require('neo4j-driver').v1;
// Config
const { NEO_URI, NEO_USER, NEO_PASS } = require('../config/keys');
// Neo4j
const driver = neo4j.driver(NEO_URI, neo4j.auth.basic(NEO_USER, NEO_PASS));
const session = driver.session();
const personName = 'Alice';
const resultPromise = session.run('CREATE (a:Person {name: $name}) RETURN a', {
name: personName
});
resultPromise
.then(result => {
session.close();
const singleRecord = result.records[0];
const node = singleRecord.get(0);
console.log(node.properties.name);
// on application exit:
driver.close();
})
.then(res => wtf.dump());
When I run my test, the database connection stays open at the end, even if I ask to close it:
wtf shows an open socket, even though I've asked to close my db connection:
127.0.0.1:51255 -> 127.0.0.1:7687
I think this is due to the
close
method in seraph/bolt callingthis.options.session && this.options.session.close();
. Since there is nosession
object on theoptions
key, theclose
method just returnsundefined
.