Skip to content

Commit e293d44

Browse files
committed
Default to seed router on construction
1 parent 34c5818 commit e293d44

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

src/v1/internal/connection-providers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class LoadBalancer extends ConnectionProvider {
7272
this._hostNameResolver = hostNameResolver;
7373
this._dnsResolver = new HostNameResolver();
7474
this._log = log;
75-
this._useSeedRouter = false;
75+
this._useSeedRouter = true;
7676
}
7777

7878
acquireConnection(accessMode) {

src/v1/internal/pool.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Pool {
6161
if (resource) {
6262
resourceAcquired(key, this._activeResourceCounts);
6363
if (this._log.isDebugEnabled()) {
64-
this._log.debug(`${resource} acquired from the pool`);
64+
this._log.debug(`${resource} acquired from the pool ${key}`);
6565
}
6666
return resource;
6767
}
@@ -94,7 +94,7 @@ class Pool {
9494
}
9595
}, this._acquisitionTimeout);
9696

97-
request = new PendingRequest(resolve, reject, timeoutId, this._log);
97+
request = new PendingRequest(key, resolve, reject, timeoutId, this._log);
9898
allRequests[key].push(request);
9999
});
100100
});
@@ -261,7 +261,8 @@ function resourceReleased(key, activeResourceCounts) {
261261

262262
class PendingRequest {
263263

264-
constructor(resolve, reject, timeoutId, log) {
264+
constructor(key, resolve, reject, timeoutId, log) {
265+
this._key = key;
265266
this._resolve = resolve;
266267
this._reject = reject;
267268
this._timeoutId = timeoutId;
@@ -281,7 +282,7 @@ class PendingRequest {
281282

282283
clearTimeout(this._timeoutId);
283284
if (this._log.isDebugEnabled()) {
284-
this._log.debug(`${resource} acquired from the pool`);
285+
this._log.debug(`${resource} acquired from the pool ${this._key}`);
285286
}
286287
this._resolve(resource);
287288
}

test/internal/bolt-stub.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,15 @@ class StubServer {
112112
}
113113

114114
function newDriver(url, config = {}) {
115+
// left here for debugging purposes
116+
const logging = {
117+
level: 'debug',
118+
logger: (level, msg) => console.log(`${level}: ${msg}`)
119+
};
115120
// boltstub currently does not support encryption, create driver with encryption turned off
116121
const newConfig = Object.assign({encrypted: 'ENCRYPTION_OFF'}, config);
122+
// use for logging enabled
123+
// const newConfig = Object.assign({encrypted: 'ENCRYPTION_OFF', logging}, config);
117124
return neo4j.driver(url, sharedNeo4j.authToken, newConfig);
118125
}
119126

test/internal/node/routing.driver.boltkit.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,7 @@ describe('routing driver with stub server', () => {
15221522
return;
15231523
}
15241524

1525-
const router1 = boltStub.start('./test/resources/boltstub/acquire_endpoints.script', 9010);
1525+
const router1 = boltStub.start('./test/resources/boltstub/acquire_endpoints_and_exit.script', 9011);
15261526
// start new router on a different port to emulate host name resolution
15271527
// this router uses different script that contains itself as reader
15281528
const router2 = boltStub.start('./test/resources/boltstub/rediscover_using_initial_router.script', 9009);
@@ -1957,13 +1957,13 @@ describe('routing driver with stub server', () => {
19571957

19581958
boltStub.run(() => {
19591959
const resolverFunction = address => {
1960-
if (address === '127.0.0.1:9001') {
1961-
return ['127.0.0.1:9010', '127.0.0.1:9011', '127.0.0.1:9042'];
1960+
if (address === '127.0.0.1:9000') {
1961+
return ['127.0.0.1:9010', '127.0.0.1:9001', '127.0.0.1:9042'];
19621962
}
19631963
throw new Error(`Unexpected address ${address}`);
19641964
};
19651965

1966-
const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001', {resolver: resolverFunction});
1966+
const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9000', { resolver: resolverFunction });
19671967

19681968
const session = driver.session(READ);
19691969
// run a query that should trigger discovery against 9001 and then read from it

0 commit comments

Comments
 (0)