Skip to content

Commit

Permalink
edited the loginTimeout options
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jy committed Oct 23, 2023
1 parent aba19ae commit 9c7a7e4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
15 changes: 8 additions & 7 deletions lib/connection/connection_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const DEFAULT_PARAMS =
'forceStageBindError',
'includeRetryReason',
'disableQueryContextCache',
'loginTimeout'
];

function consolidateHostAndAccount(options)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -976,7 +977,7 @@ function createParameters()
},
{
name: PARAM_RETRY_SF_STARTING_SLEEP_TIME,
defaultValue: 1,
defaultValue: 4,
validate: isNonNegativeNumber
},
{
Expand Down
2 changes: 1 addition & 1 deletion lib/constants/error_messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.';
Expand Down
2 changes: 1 addition & 1 deletion lib/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/services/sf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions test/unit/connection/connection_config_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down Expand Up @@ -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:
{
Expand Down

0 comments on commit 9c7a7e4

Please sign in to comment.