@nsshunt/ststestrunner 1.1.138 → 1.1.140
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ststestrunner.mjs
CHANGED
|
@@ -979,8 +979,6 @@ var TestCaseFhirBase = class {
|
|
|
979
979
|
#publishTelemetryTimeout = null;
|
|
980
980
|
#publishTelemetryTimeoutVal = 1e3;
|
|
981
981
|
randomSequence = [];
|
|
982
|
-
_currentWorkerManagerIndex = 0;
|
|
983
|
-
_indexTable = {};
|
|
984
982
|
_RetryMap = [
|
|
985
983
|
100,
|
|
986
984
|
250,
|
|
@@ -1185,6 +1183,14 @@ var TestCaseFhirBase = class {
|
|
|
1185
1183
|
await this.#ForcePublishTelemetryData();
|
|
1186
1184
|
return true;
|
|
1187
1185
|
};
|
|
1186
|
+
hashString(str) {
|
|
1187
|
+
let hash = 2166136261;
|
|
1188
|
+
for (let i = 0; i < str.length; i++) {
|
|
1189
|
+
hash ^= str.charCodeAt(i);
|
|
1190
|
+
hash = Math.imul(hash, 16777619);
|
|
1191
|
+
}
|
|
1192
|
+
return hash >>> 0;
|
|
1193
|
+
}
|
|
1188
1194
|
_GetDetail = () => {
|
|
1189
1195
|
const options = this.runner.options;
|
|
1190
1196
|
const { runPrefix, testType, description } = options;
|
|
@@ -1293,13 +1299,10 @@ var TestCaseFhirBase = class {
|
|
|
1293
1299
|
210
|
|
1294
1300
|
]
|
|
1295
1301
|
];
|
|
1296
|
-
if (this._indexTable[workerManagerId] === void 0) this._indexTable[workerManagerId] = this._currentWorkerManagerIndex++;
|
|
1297
|
-
const workerManagerIndex = this._indexTable[workerManagerId];
|
|
1298
1302
|
const rgbTableRow = rgbTable[options.workerIndex % rgbTable.length];
|
|
1299
|
-
const workerManagerRGBTableRow = workerManagerRGBTable[
|
|
1303
|
+
const workerManagerRGBTableRow = workerManagerRGBTable[this.hashString(workerManagerId) % workerManagerRGBTable.length];
|
|
1300
1304
|
const wkCol = chalk.rgb(rgbTableRow[0], rgbTableRow[1], rgbTableRow[2]);
|
|
1301
1305
|
const wkColWM = chalk.rgb(workerManagerRGBTableRow[0], workerManagerRGBTableRow[1], workerManagerRGBTableRow[2]);
|
|
1302
|
-
console.log(`${workerManagerId} = ${workerManagerIndex} ${JSON.stringify(this._indexTable)}`);
|
|
1303
1306
|
return wkCol(`runPrefix: [${chalk.bold(runPrefix)}], testType: [${chalk.bold(testType)}], description: [${chalk.bold(description)}], workerManagerId: [${wkColWM(chalk.bold(workerManagerId))}], Iteration: [${chalk.bold(iteration.toString())}]`);
|
|
1304
1307
|
};
|
|
1305
1308
|
_CheckOutputLongDurationError = (snapshotStart, message) => {
|
|
@@ -36986,25 +36989,17 @@ var AuthHelper = class extends import_tiny_emitter.TinyEmitter {
|
|
|
36986
36989
|
if (this.#accesssToken) return this.#accesssToken;
|
|
36987
36990
|
const lockKey = "GetAccessToken";
|
|
36988
36991
|
const lockTimeout = 6e4;
|
|
36989
|
-
if (this._lockHelper.GetOnHold(lockKey) === true) {
|
|
36990
|
-
|
|
36991
|
-
|
|
36992
|
-
|
|
36993
|
-
|
|
36994
|
-
this.
|
|
36995
|
-
|
|
36996
|
-
this.Debug(chalk.green(`GetAccessToken(): Getting existing accesssToken (post hold release), lock key: [${lockKey}]`));
|
|
36997
|
-
return this.#accesssToken;
|
|
36998
|
-
} else {
|
|
36999
|
-
this.Error(chalk.red(`GetAccessToken(): Could not get existing accesssToken (post hold release), lock key: [${lockKey}]`));
|
|
37000
|
-
this.Error(chalk.red(`GetAccessToken(): continue anyway ...`));
|
|
37001
|
-
}
|
|
37002
|
-
} catch (error) {
|
|
37003
|
-
this.Error(chalk.red(`GetAccessToken(): Error: [${error}]`));
|
|
36992
|
+
if (this._lockHelper.GetOnHold(lockKey) === true) try {
|
|
36993
|
+
performance.now();
|
|
36994
|
+
await this._lockHelper.WaitOnHold(lockKey, lockTimeout);
|
|
36995
|
+
if (this.#accesssToken) return this.#accesssToken;
|
|
36996
|
+
else {
|
|
36997
|
+
this.Error(chalk.red(`GetAccessToken(): Could not get existing accesssToken (post hold release), lock key: [${lockKey}]`));
|
|
36998
|
+
this.Error(chalk.red(`GetAccessToken(): continue anyway ...`));
|
|
37004
36999
|
}
|
|
37000
|
+
} catch (error) {
|
|
37001
|
+
this.Error(chalk.red(`GetAccessToken(): Error: [${error}]`));
|
|
37005
37002
|
}
|
|
37006
|
-
this.Debug(chalk.yellow(`GetAccessToken(): accesssToken does not exist - setting up new accesssToken`));
|
|
37007
|
-
this.Debug(chalk.yellow(`GetAccessToken(): setting hold (lock), lock key: [${lockKey}]`));
|
|
37008
37003
|
this._lockHelper.SetOnHold(lockKey);
|
|
37009
37004
|
timeout = setTimeout(() => {
|
|
37010
37005
|
this.Warning(chalk.magenta(`GetAccessToken(): Timeout: [${this._authMaxTimeout}] exceeded for getting access token ...`));
|
|
@@ -37022,7 +37017,6 @@ var AuthHelper = class extends import_tiny_emitter.TinyEmitter {
|
|
|
37022
37017
|
if (totalTime > this._authMaxTimeout) this.Warning(chalk.magenta(`GetAccessToken(): The total time for getting the access token: [${totalTime}]`));
|
|
37023
37018
|
this.#accesssToken = workingAaccesssToken;
|
|
37024
37019
|
this._lockHelper.ReleaseOnHold(lockKey);
|
|
37025
|
-
this.Debug(chalk.yellow(`GetAccessToken(): release hold (lock) Time taken for get access token: [${performance.now() - start}ms], lock key: [${lockKey}]`));
|
|
37026
37020
|
return this.#accesssToken;
|
|
37027
37021
|
} catch (error) {
|
|
37028
37022
|
if (timeout) clearTimeout(timeout);
|