Skip to content

Commit 6d102c4

Browse files
authored
Merge pull request #482 from ali-ince/1.7-connection-timeout-30s
Increase default connection timeout configuration value
2 parents 1a6e4d7 + 3a64624 commit 6d102c4

File tree

63 files changed

+2338
-2004
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2338
-2004
lines changed

package-lock.json

Lines changed: 1981 additions & 1767 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,27 @@
4040
"jsdelivr": "lib/browser/neo4j-web.js",
4141
"types": "types/index.d.ts",
4242
"devDependencies": {
43-
"@babel/core": "^7.4.4",
44-
"@babel/plugin-transform-runtime": "^7.4.4",
45-
"@babel/preset-env": "^7.4.4",
46-
"@babel/register": "^7.4.4",
47-
"async": "^3.0.0",
48-
"babel-eslint": "^10.0.1",
43+
"@babel/core": "^7.5.5",
44+
"@babel/plugin-transform-runtime": "^7.5.5",
45+
"@babel/preset-env": "^7.5.5",
46+
"@babel/register": "^7.5.5",
47+
"async": "^3.1.0",
48+
"babel-eslint": "^10.0.3",
4949
"babelify": "^10.0.0",
50-
"browserify": "^16.2.3",
50+
"browserify": "^16.5.0",
5151
"browserify-transform-tools": "^1.7.0",
5252
"esdoc": "^1.1.0",
5353
"esdoc-importpath-plugin": "^1.0.2",
5454
"esdoc-standard-plugin": "^1.0.0",
55-
"eslint": "^5.16.0",
56-
"eslint-config-standard": "^12.0.0",
57-
"eslint-plugin-import": "^2.17.2",
55+
"eslint": "^6.2.2",
56+
"eslint-config-standard": "^14.0.1",
57+
"eslint-plugin-import": "^2.18.2",
5858
"eslint-plugin-jasmine": "^2.10.1",
59-
"eslint-plugin-node": "^9.0.1",
60-
"eslint-plugin-promise": "^4.1.1",
61-
"eslint-plugin-standard": "^4.0.0",
59+
"eslint-plugin-node": "^9.1.0",
60+
"eslint-plugin-promise": "^4.2.1",
61+
"eslint-plugin-standard": "^4.0.1",
6262
"fancy-log": "^1.3.3",
63-
"fs-extra": "^8.0.1",
63+
"fs-extra": "^8.1.0",
6464
"gulp": "^4.0.2",
6565
"gulp-babel": "^8.0.0",
6666
"gulp-batch": "^1.0.5",
@@ -73,34 +73,34 @@
7373
"gulp-typescript": "^5.0.1",
7474
"gulp-uglify": "^3.0.2",
7575
"gulp-watch": "^5.0.1",
76-
"husky": "^2.3.0",
76+
"husky": "^3.0.4",
7777
"jasmine-console-reporter": "^3.1.0",
78-
"karma": "^4.1.0",
79-
"karma-browserify": "^6.0.0",
80-
"karma-chrome-launcher": "^2.2.0",
78+
"karma": "^4.2.0",
79+
"karma-browserify": "^6.1.0",
80+
"karma-chrome-launcher": "^3.1.0",
8181
"karma-edge-launcher": "^0.4.2",
82-
"karma-firefox-launcher": "^1.1.0",
82+
"karma-firefox-launcher": "^1.2.0",
8383
"karma-ie-launcher": "^1.0.0",
8484
"karma-jasmine": "^2.0.1",
8585
"karma-source-map-support": "^1.4.0",
8686
"karma-spec-reporter": "^0.0.32",
87-
"lint-staged": "^8.1.7",
88-
"lodash": "^4.17.11",
89-
"lolex": "^4.0.1",
87+
"lint-staged": "^9.2.5",
88+
"lodash": "^4.17.15",
89+
"lolex": "^4.2.0",
9090
"minimist": "^1.2.0",
91-
"mustache": "^3.0.1",
92-
"prettier-eslint": "^8.8.2",
93-
"prettier-eslint-cli": "^4.7.1",
91+
"mustache": "^3.0.3",
92+
"prettier-eslint": "^9.0.0",
93+
"prettier-eslint-cli": "^5.0.0",
9494
"run-sequence": "^2.2.1",
95-
"semver": "^6.0.0",
95+
"semver": "^6.3.0",
9696
"tmp": "0.1.0",
97-
"typescript": "^3.4.5",
97+
"typescript": "^3.5.3",
9898
"vinyl-buffer": "^1.0.1",
9999
"vinyl-source-stream": "^2.0.0",
100-
"webpack": "^4.32.0"
100+
"webpack": "^4.39.3"
101101
},
102102
"dependencies": {
103-
"@babel/runtime": "^7.4.4",
103+
"@babel/runtime": "^7.5.5",
104104
"text-encoding-utf-8": "^1.0.2",
105105
"uri-js": "^4.2.2"
106106
}

src/v1/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ const logging = {
211211
*
212212
* // Specify socket connection timeout in milliseconds. Numeric values are expected. Negative and zero values
213213
* // result in no timeout being applied. Connection establishment will be then bound by the timeout configured
214-
* // on the operating system level. Default value is 5000, which is 5 seconds.
215-
* connectionTimeout: 5000, // 5 seconds
214+
* // on the operating system level. Default value is 30000, which is 30 seconds.
215+
* connectionTimeout: 30000, // 30 seconds
216216
*
217217
* // Make this driver always return native JavaScript numbers for integer values, instead of the
218218
* // dedicated {@link Integer} class. Values that do not fit in native number bit range will be represented as

src/v1/internal/bolt-protocol-v3.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import RequestMessage from './request-message'
2121

2222
export default class BoltProtocol extends BoltProtocolV2 {
2323
transformMetadata (metadata) {
24-
if (metadata.t_first) {
24+
if ('t_first' in metadata) {
2525
// Bolt V3 uses shorter key 't_first' to represent 'result_available_after'
2626
// adjust the key to be the same as in Bolt V1 so that ResultSummary can retrieve the value
2727
metadata.result_available_after = metadata.t_first
2828
delete metadata.t_first
2929
}
30-
if (metadata.t_last) {
30+
if ('t_last' in metadata) {
3131
// Bolt V3 uses shorter key 't_last' to represent 'result_consumed_after'
3232
// adjust the key to be the same as in Bolt V1 so that ResultSummary can retrieve the value
3333
metadata.result_consumed_after = metadata.t_last

src/v1/internal/channel-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import { newError, SERVICE_UNAVAILABLE } from '../error'
2121
import { ENCRYPTION_OFF, ENCRYPTION_ON } from './util'
2222

23-
const DEFAULT_CONNECTION_TIMEOUT_MILLIS = 5000 // 5 seconds by default
23+
const DEFAULT_CONNECTION_TIMEOUT_MILLIS = 30000 // 30 seconds by default
2424

2525
const ALLOWED_VALUES_ENCRYPTED = [
2626
null,

src/v1/result-summary.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ class ProfiledPlan {
167167
this.operatorType = profile.operatorType
168168
this.identifiers = profile.identifiers
169169
this.arguments = profile.args
170-
this.dbHits = profile.args.DbHits.toInt()
171-
this.rows = profile.args.Rows.toInt()
170+
this.dbHits = intValue(profile.args.DbHits)
171+
this.rows = intValue(profile.args.Rows)
172172
this.children = profile.children
173173
? profile.children.map(child => new ProfiledPlan(child))
174174
: []
@@ -201,11 +201,9 @@ class StatementStatistics {
201201
}
202202
Object.keys(statistics).forEach(index => {
203203
// To camelCase
204-
this._stats[index.replace(/(-\w)/g, m => m[1].toUpperCase())] = isInt(
204+
this._stats[index.replace(/(-\w)/g, m => m[1].toUpperCase())] = intValue(
205205
statistics[index]
206206
)
207-
? statistics[index].toInt()
208-
: statistics[index]
209207
})
210208
}
211209

@@ -322,9 +320,9 @@ class Notification {
322320
return {}
323321
}
324322
return {
325-
offset: pos.offset.toInt(),
326-
line: pos.line.toInt(),
327-
column: pos.column.toInt()
323+
offset: intValue(pos.offset),
324+
line: intValue(pos.line),
325+
column: intValue(pos.column)
328326
}
329327
}
330328
}
@@ -347,6 +345,10 @@ class ServerInfo {
347345
}
348346
}
349347

348+
function intValue (value) {
349+
return isInt(value) ? value.toInt() : value
350+
}
351+
350352
const statementType = {
351353
READ_ONLY: 'r',
352354
READ_WRITE: 'rw',

test/internal/channel-config.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ describe('ChannelConfig', () => {
109109
it('should have connection timeout by default', () => {
110110
const config = new ChannelConfig(null, {}, '')
111111

112-
expect(config.connectionTimeout).toEqual(5000)
112+
expect(config.connectionTimeout).toEqual(30000)
113113
})
114114

115115
it('should respect configured connection timeout', () => {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ describe('direct driver with stub server', () => {
287287

288288
boltStub.run(() => {
289289
const driver = boltStub.newDriver('bolt://127.0.0.1:9001')
290-
const session = driver.session()
290+
const session = driver.session(neo4j.session.READ)
291291
session.run('MATCH (n) RETURN n.name').catch(error => {
292292
expect(error.code).toEqual(neo4j.error.SERVICE_UNAVAILABLE)
293293

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,15 +503,15 @@ describe('routing driver with stub server', () => {
503503
9001
504504
)
505505
const readServer = boltStub.start(
506-
'./test/resources/boltstub/dead_read_server.script',
506+
'./test/resources/boltstub/dead_write_server.script',
507507
9007
508508
)
509509

510510
boltStub.run(() => {
511511
const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001')
512512
// When
513513
const session = driver.session(neo4j.session.WRITE)
514-
session.run('MATCH (n) RETURN n.name').catch(err => {
514+
session.run("CREATE (n {name:'Bob'})").catch(err => {
515515
expect(err.code).toEqual(neo4j.error.SESSION_EXPIRED)
516516
driver.close()
517517
seedServer.exit(code1 => {
@@ -1909,7 +1909,7 @@ describe('routing driver with stub server', () => {
19091909

19101910
boltStub.run(() => {
19111911
const driver = boltStub.newDriver('bolt+routing://127.0.0.1:9001')
1912-
const session = driver.session()
1912+
const session = driver.session(neo4j.session.READ)
19131913
session.run('MATCH (n) RETURN n.name AS name').then(result => {
19141914
const names = result.records.map(record => record.get('name'))
19151915
expect(names).toEqual(['Alice', 'Bob', 'Eve'])
@@ -2758,7 +2758,7 @@ describe('routing driver with stub server', () => {
27582758
'./test/resources/boltstub/address_unavailable_template.script.mst'
27592759
const server = boltStub.startWithTemplate(
27602760
serverTemplateScript,
2761-
{ query: query },
2761+
{ query: query, mode: accessMode === READ ? '"mode": "r"' : '' },
27622762
serverPort
27632763
)
27642764

test/resources/boltstub/acquire_endpoints.script

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
!: AUTO INIT
1+
!: BOLT 3
2+
!: AUTO HELLO
23
!: AUTO RESET
34
!: AUTO PULL_ALL
5+
!: AUTO GOODBYE
46

5-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}}
7+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
68
PULL_ALL
79
S: SUCCESS {"fields": ["ttl", "servers"]}
810
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9007","127.0.0.1:9008"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9005","127.0.0.1:9006"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002","127.0.0.1:9003"], "role": "ROUTE"}]]

test/resources/boltstub/acquire_endpoints_and_exit.script

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
!: AUTO INIT
1+
!: BOLT 3
2+
!: AUTO HELLO
23
!: AUTO RESET
34
!: AUTO PULL_ALL
5+
!: AUTO GOODBYE
46

5-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}}
7+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
68
PULL_ALL
79
S: SUCCESS {"fields": ["ttl", "servers"]}
810
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9007","127.0.0.1:9008"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9005","127.0.0.1:9006"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002","127.0.0.1:9003"], "role": "ROUTE"}]]

test/resources/boltstub/acquire_endpoints_v3.script

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
!: BOLT 3
22
!: AUTO RESET
3+
!: AUTO GOODBYE
34

45
C: HELLO {"scheme": "basic", "principal": "neo4j", "credentials": "password", "user_agent": "neo4j-javascript/0.0.0-dev"}
56
S: SUCCESS {"server": "Neo4j/9.9.9", "connection_id": "bolt-123456789"}

test/resources/boltstub/acquire_endpoints_v3_empty.script

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
!: BOLT 3
22
!: AUTO HELLO
33
!: AUTO RESET
4+
!: AUTO GOODBYE
45

56
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
67
PULL_ALL

test/resources/boltstub/acquire_endpoints_v3_point_to_empty_router_and_exit.script

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
!: BOLT 3
22
!: AUTO HELLO
33
!: AUTO RESET
4+
!: AUTO GOODBYE
45

56
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
67
PULL_ALL

test/resources/boltstub/acquire_endpoints_v3_three_servers_and_exit.script

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
!: BOLT 3
22
!: AUTO HELLO
3+
!: AUTO GOODBYE
34

45
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
56
PULL_ALL

test/resources/boltstub/acquire_endpoints_with_one_of_each.script

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
!: AUTO INIT
1+
!: BOLT 3
2+
!: AUTO HELLO
23
!: AUTO RESET
34
!: AUTO PULL_ALL
5+
!: AUTO GOODBYE
46

5-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}}
7+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
68
PULL_ALL
79
S: SUCCESS {"fields": ["ttl", "servers"]}
810
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9007"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9005"], "role": "READ"},{"addresses": ["127.0.0.1:9001","127.0.0.1:9002"], "role": "ROUTE"}]]
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
!: AUTO INIT
1+
!: BOLT 3
2+
!: AUTO HELLO
23
!: AUTO RESET
34
!: AUTO PULL_ALL
4-
!: AUTO RUN "ROLLBACK" {}
5-
!: AUTO RUN "BEGIN" {}
6-
!: AUTO RUN "COMMIT" {}
5+
!: AUTO ROLLBACK
6+
!: AUTO BEGIN
7+
!: AUTO COMMIT
8+
!: AUTO GOODBYE
79

8-
C: RUN "{{{query}}}" {}
10+
C: RUN "{{{query}}}" {} { {{{mode}}} }
911
C: PULL_ALL
1012
S: FAILURE {"code": "Neo.TransientError.General.DatabaseUnavailable", "message": "Database is busy doing store copy"}
1113
S: IGNORED
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
!: AUTO INIT
1+
!: BOLT 3
2+
!: AUTO HELLO
23
!: AUTO RESET
34
!: AUTO PULL_ALL
4-
!: AUTO RUN "BEGIN" {}
5+
!: AUTO BEGIN
6+
!: AUTO GOODBYE
57

6-
C: RUN "MATCH (n) RETURN n.name" {}
8+
C: RUN "MATCH (n) RETURN n.name" {} {"mode": "r"}
79
C: PULL_ALL
810
S: <EXIT>
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
!: AUTO INIT
1+
!: BOLT 3
2+
!: AUTO HELLO
23
!: AUTO RESET
34
!: AUTO PULL_ALL
45

5-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}}
6+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
67
C: PULL_ALL
78
S: <EXIT>
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
!: AUTO INIT
1+
!: BOLT 3
2+
!: AUTO HELLO
23
!: AUTO RESET
34
!: AUTO PULL_ALL
4-
!: AUTO RUN "BEGIN" {}
5+
!: AUTO BEGIN
6+
!: AUTO GOODBYE
57

6-
C: RUN "CREATE (n {name:'Bob'})" {}
8+
C: RUN "CREATE (n {name:'Bob'})" {} {}
79
C: PULL_ALL
810
S: <EXIT>
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
!: AUTO INIT
1+
!: BOLT 3
2+
!: AUTO HELLO
23
!: AUTO RESET
34
!: AUTO PULL_ALL
5+
!: AUTO GOODBYE
46

5-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}}
7+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
68
PULL_ALL
79
S: SUCCESS {"fields": ["ttl", "servers"]}
810
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9001", "[::1]:9001"],"role": "READ"}, {"addresses": ["[2001:db8:a0b:12f0::1]:9002","[3731:54:65fe:2::a7]:9003"], "role": "WRITE"},{"addresses": ["[ff02::1]:9001","[684D:1111:222:3333:4444:5555:6:77]:9002","[::1]:9003"], "role": "ROUTE"}]]
911
SUCCESS {}
10-
C: RUN "MATCH (n) RETURN n.name" {}
12+
C: RUN "MATCH (n) RETURN n.name" {} {"mode": "r"}
1113
PULL_ALL
1214
S: SUCCESS {"fields": ["n.name"]}
1315
SUCCESS {}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
!: AUTO INIT
1+
!: BOLT 3
2+
!: AUTO HELLO
23
!: AUTO RESET
34
!: AUTO PULL_ALL
5+
!: AUTO GOODBYE
46

5-
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}}
7+
C: RUN "CALL dbms.cluster.routing.getRoutingTable($context)" {"context": {}} {}
68
PULL_ALL
79
S: SUCCESS {"fields": ["ttl", "servers"]}
810
RECORD [9223372036854775807, [{"addresses": ["127.0.0.1:9001"],"role": "WRITE"}, {"addresses": ["127.0.0.1:9005","127.0.0.1:9003"], "role": "READ"},{"addresses": ["127.0.0.1:9004","127.0.0.1:9002","127.0.0.1:9003"], "role": "ROUTE"}]]
911
SUCCESS {}
10-
C: RUN "MATCH (n) RETURN n.name" {}
12+
C: RUN "MATCH (n) RETURN n.name" {} {}
1113
PULL_ALL
1214
S: SUCCESS {"fields": ["n.name"]}
1315
SUCCESS {}

0 commit comments

Comments
 (0)