Skip to content

Commit 1d8ccc3

Browse files
committed
Set default connection timeout to 5 seconds
To align the value with other drivers.
1 parent 56941b8 commit 1d8ccc3

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/v1/internal/ch-config.js

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

23-
const DEFAULT_CONNECTION_TIMEOUT_MILLIS = 0; // turned off by default
23+
const DEFAULT_CONNECTION_TIMEOUT_MILLIS = 5000; // 5 seconds by default
2424

2525
export default class ChannelConfig {
2626

test/internal/ch-config.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,16 @@ describe('ChannelConfig', () => {
110110
expect(config.connectionErrorCode).toEqual(SERVICE_UNAVAILABLE);
111111
});
112112

113+
it('should have connection timeout by default', () => {
114+
const config = new ChannelConfig('', 42, {}, '');
115+
116+
expect(config.connectionTimeout).toEqual(5000);
117+
});
118+
119+
it('should respect configured connection timeout', () => {
120+
const config = new ChannelConfig('', 42, {connectionTimeout: 424242}, '');
121+
122+
expect(config.connectionTimeout).toEqual(424242);
123+
});
124+
113125
});

0 commit comments

Comments
 (0)