Skip to content

Commit

Permalink
fix: remove changes outside deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Apr 13, 2023
1 parent 47c81d8 commit 0b47ae9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/cmap/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,13 @@ function makeConnection(options: MakeConnectionOptions, _callback: Callback<Stre
const useTLS = options.tls ?? false;
const keepAlive = options.keepAlive ?? true;
const noDelay = options.noDelay ?? true;
const socketTimeoutMS = options.socketTimeoutMS ?? Reflect.get(options, 'socketTimeout') ?? 0;
const connectTimeoutMS = options.connectTimeoutMS ?? 30000;
const rejectUnauthorized = options.rejectUnauthorized ?? true;
// Default to delay to 300 seconds. Node automatically then sets TCP_KEEPINTVL to 1 second
// which is acceptable to the recommendation of 10 seconds and also cannot be configured.
// TCP_KEEPCNT is also set to 10 in Node and cannot be configured. (Recommendation is 9)
const keepAliveInitialDelay = options.keepAliveInitialDelay;
const keepAliveInitialDelay =
((options.keepAliveInitialDelay ?? 120000) > socketTimeoutMS
? Math.round(socketTimeoutMS / 2)
: options.keepAliveInitialDelay) ?? 120000;
const existingSocket = options.existingSocket;

let socket: Stream;
Expand Down
2 changes: 1 addition & 1 deletion src/connection_string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ export const OPTIONS = {
deprecated: 'Will not be able to turn off in the future.'
},
keepAliveInitialDelay: {
default: 300000,
default: 120000,
type: 'uint',
deprecated: 'Will not be configurable in the future.'
},
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mongo_client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ describe('MongoOptions', function () {
['forceserverobjectid', false],
['heartbeatfrequencyms', 10000],
['keepalive', true],
['keepaliveinitialdelay', 300000],
['keepaliveinitialdelay', 120000],
['localthresholdms', 15],
['maxidletimems', 0],
['maxpoolsize', 100],
Expand Down

0 comments on commit 0b47ae9

Please sign in to comment.