From 9c7a7e4fdca5882aeeba940ef075574440bff492 Mon Sep 17 00:00:00 2001 From: sfc-gh-ext-simba-jy Date: Mon, 23 Oct 2023 13:16:55 -0700 Subject: [PATCH] edited the loginTimeout options --- lib/connection/connection_config.js | 15 ++++++++------- lib/constants/error_messages.js | 2 +- lib/errors.js | 2 +- lib/services/sf.js | 2 +- test/unit/connection/connection_config_test.js | 6 +++--- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/connection/connection_config.js b/lib/connection/connection_config.js index 41ab172ee..fc8811f85 100644 --- a/lib/connection/connection_config.js +++ b/lib/connection/connection_config.js @@ -51,6 +51,7 @@ const DEFAULT_PARAMS = 'forceStageBindError', 'includeRetryReason', 'disableQueryContextCache', + 'loginTimeout' ]; function consolidateHostAndAccount(options) @@ -483,12 +484,12 @@ function ConnectionConfig(options, validateCredentials, qaMode, clientInfo) disableQueryContextCache = options.disableQueryContextCache; } - let maxLoginTimeout = 300; - if (Util.exists(options.maxLoginTimeout)) { - Errors.checkArgumentValid(Util.isNumber(options.maxLoginTimeout), + let loginTimeout = 300; + if (Util.exists(options.loginTimeout)) { + Errors.checkArgumentValid(Util.isNumber(options.loginTimeout), ErrorCodes.ERR_CONN_CREATE_INVALID_MAX_LOGIN_TIMEOUT); - maxLoginTimeout = options.maxLoginTimeout; + loginTimeout = options.loginTimeout > 300 ? options.loginTimeout : 300; } if (validateDefaultParameters) @@ -806,8 +807,8 @@ function ConnectionConfig(options, validateCredentials, qaMode, clientInfo) * * @returns {Number} */ - this.getMaxLoginTimeout = function () { - return maxLoginTimeout; + this.getLoginTimeout = function () { + return loginTimeout; } // save config options @@ -976,7 +977,7 @@ function createParameters() }, { name: PARAM_RETRY_SF_STARTING_SLEEP_TIME, - defaultValue: 1, + defaultValue: 4, validate: isNonNegativeNumber }, { diff --git a/lib/constants/error_messages.js b/lib/constants/error_messages.js index 1618bd5f9..fe7157917 100644 --- a/lib/constants/error_messages.js +++ b/lib/constants/error_messages.js @@ -68,7 +68,7 @@ exports[404040] = 'Invalid browser timeout value. The specified value must be a exports[404041] = 'Invalid disablQueryContextCache. The specified value must be a boolean.'; exports[404042] = 'Invalid includeRetryReason. The specified value must be a boolean.' exports[404043] = 'Invalid clientConfigFile value. The specified value must be a string.'; -exports[404044] = 'Invalid loginMaxTimeout value. The specified value must be a number.'; +exports[404044] = 'Invalid loginTimeout value. The specified value must be a number.'; // 405001 exports[405001] = 'Invalid callback. The specified value must be a function.'; diff --git a/lib/errors.js b/lib/errors.js index 4806617b1..3b08a888b 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -73,7 +73,7 @@ codes.ERR_CONN_CREATE_INVALID_BROWSER_TIMEOUT = 404040; codes.ERR_CONN_CREATE_INVALID_DISABLED_QUERY_CONTEXT_CACHE = 404041 codes.ERR_CONN_CREATE_INVALID_INCLUDE_RETRY_REASON =404042 codes.ERR_CONN_CREATE_INVALID_CLIENT_CONFIG_FILE = 404043; -codes.ERR_CONN_CREATE_INVALID_MAX_LOGIN_TIMEOUT = 404044; +codes.ERR_CONN_CREATE_INVALID_LOGIN_TIMEOUT = 404044; // 405001 codes.ERR_CONN_CONNECT_INVALID_CALLBACK = 405001; diff --git a/lib/services/sf.js b/lib/services/sf.js index 144196bc5..ec3ee4564 100644 --- a/lib/services/sf.js +++ b/lib/services/sf.js @@ -1179,7 +1179,7 @@ StateConnecting.prototype.continue = function () const startTime = connectionConfig.accessUrl.startsWith('https://') ? Date.now() : 'FIXEDTIMESTAMP'; const maxLoginRetries = connectionConfig.getRetrySfMaxLoginRetries(); - const maxLoginTimeout = connectionConfig.getMaxLoginTimeout(); + const maxLoginTimeout = connectionConfig.getLoginTimeout(); let sleep = connectionConfig.getRetrySfStartingSleepTime(); let totalTimeout = sleep; const cap = connectionConfig.getRetrySfMaxSleepTime(); diff --git a/test/unit/connection/connection_config_test.js b/test/unit/connection/connection_config_test.js index c1f1baedb..d21250fd1 100644 --- a/test/unit/connection/connection_config_test.js +++ b/test/unit/connection/connection_config_test.js @@ -552,7 +552,7 @@ describe('ConnectionConfig: basic', function () account: 'account', username: 'username', password: 'password', - maxLoginTimeout: 'invalud' + loginTimeout: 'invalud' }, errorCode: ErrorCodes.ERR_CONN_CREATE_INVALID_MAX_LOGIN_TIMEOUT }, @@ -925,13 +925,13 @@ describe('ConnectionConfig: basic', function () } }, { - name: 'max login time out', + name: 'login time out', input: { account: 'account', username: 'username', password: 'password', - maxLoginTimeout: 100, + loginTimeout: 1234, }, options: {