Skip to content

Commit

Permalink
Updated datatabaseOptions to include minPoolSize, connectTimeoutMS, s…
Browse files Browse the repository at this point in the history
…ocketTimeoutMS
  • Loading branch information
pocketcolin committed Jan 9, 2025
1 parent a579eeb commit 3a685f2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions spec/ParseConfigKey.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ describe('Config Keys', () => {
maxTimeMS: 1000,
maxStalenessSeconds: 10,
maxPoolSize: 10,
minPoolSize: 5,
connectTimeoutMS: 5000,
socketTimeoutMS: 5000,
},
})).toBeResolved();
expect(loggerErrorSpy.calls.all().reduce((s, call) => s += call.args[0], '')).not.toMatch(invalidKeyErrorMessage);
Expand Down
18 changes: 18 additions & 0 deletions src/Options/Definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,12 @@ module.exports.DatabaseOptions = {
action: parsers.booleanParser,
default: false,
},
minPoolSize: {
env: 'PARSE_SERVER_DATABASE_MIN_POOL_SIZE',
help:
'The MongoDB driver option to set the minimum number of opened, cached, ready-to-use database connections maintained by the driver.',
action: parsers.numberParser('minPoolSize'),
},
maxPoolSize: {
env: 'PARSE_SERVER_DATABASE_MAX_POOL_SIZE',
help:
Expand Down Expand Up @@ -1080,6 +1086,18 @@ module.exports.DatabaseOptions = {
'The duration in seconds after which the schema cache expires and will be refetched from the database. Use this option if using multiple Parse Servers instances connected to the same database. A low duration will cause the schema cache to be updated too often, causing unnecessary database reads. A high duration will cause the schema to be updated too rarely, increasing the time required until schema changes propagate to all server instances. This feature can be used as an alternative or in conjunction with the option `enableSchemaHooks`. Default is infinite which means the schema cache never expires.',
action: parsers.numberParser('schemaCacheTtl'),
},
connectTimeoutMS: {
env: 'PARSE_SERVER_DATABASE_CONNECT_TIMEOUT_MS',
help:
'Specifies the amount of time, in milliseconds, to wait to establish a single TCP socket connection to the server before raising an error. Specifying 0 disables the connection timeout.',
action: parsers.numberParser('connectTimeoutMS'),
},
socketTimeoutMS: {
env: 'PARSE_SERVER_DATABASE_SOCKET_TIMEOUT_MS',
help:
'Specifies the amount of time, in milliseconds, spent attempting to send or receive on a socket before timing out. Specifying 0 means no timeout.',
action: parsers.numberParser('socketTimeoutMS'),
},
};
module.exports.AuthAdapter = {
enabled: {
Expand Down
3 changes: 3 additions & 0 deletions src/Options/docs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/Options/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,14 @@ export interface DatabaseOptions {
maxTimeMS: ?number;
/* The MongoDB driver option to set the maximum replication lag for reads from secondary nodes.*/
maxStalenessSeconds: ?number;
/* The MongoDB driver option to set the minimum number of opened, cached, ready-to-use database connections maintained by the driver. */
minPoolSize: ?number;
/* The MongoDB driver option to set the maximum number of opened, cached, ready-to-use database connections maintained by the driver. */
maxPoolSize: ?number;
/* Specifies the amount of time, in milliseconds, to wait to establish a single TCP socket connection to the server before raising an error. Specifying 0 disables the connection timeout. */
connectTimeoutMS
/* Specifies the amount of time, in milliseconds, spent attempting to send or receive on a socket before timing out. Specifying 0 means no timeout. */
socketTimeoutMS
}

export interface AuthAdapter {
Expand Down

0 comments on commit 3a685f2

Please sign in to comment.