@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.cjs
CHANGED
|
@@ -984,8 +984,6 @@ var TestCaseFhirBase = class {
|
|
|
984
984
|
#publishTelemetryTimeout = null;
|
|
985
985
|
#publishTelemetryTimeoutVal = 1e3;
|
|
986
986
|
randomSequence = [];
|
|
987
|
-
_currentWorkerManagerIndex = 0;
|
|
988
|
-
_indexTable = {};
|
|
989
987
|
_RetryMap = [
|
|
990
988
|
100,
|
|
991
989
|
250,
|
|
@@ -1190,6 +1188,14 @@ var TestCaseFhirBase = class {
|
|
|
1190
1188
|
await this.#ForcePublishTelemetryData();
|
|
1191
1189
|
return true;
|
|
1192
1190
|
};
|
|
1191
|
+
hashString(str) {
|
|
1192
|
+
let hash = 2166136261;
|
|
1193
|
+
for (let i = 0; i < str.length; i++) {
|
|
1194
|
+
hash ^= str.charCodeAt(i);
|
|
1195
|
+
hash = Math.imul(hash, 16777619);
|
|
1196
|
+
}
|
|
1197
|
+
return hash >>> 0;
|
|
1198
|
+
}
|
|
1193
1199
|
_GetDetail = () => {
|
|
1194
1200
|
const options = this.runner.options;
|
|
1195
1201
|
const { runPrefix, testType, description } = options;
|
|
@@ -1298,13 +1304,10 @@ var TestCaseFhirBase = class {
|
|
|
1298
1304
|
210
|
|
1299
1305
|
]
|
|
1300
1306
|
];
|
|
1301
|
-
if (this._indexTable[workerManagerId] === void 0) this._indexTable[workerManagerId] = this._currentWorkerManagerIndex++;
|
|
1302
|
-
const workerManagerIndex = this._indexTable[workerManagerId];
|
|
1303
1307
|
const rgbTableRow = rgbTable[options.workerIndex % rgbTable.length];
|
|
1304
|
-
const workerManagerRGBTableRow = workerManagerRGBTable[
|
|
1308
|
+
const workerManagerRGBTableRow = workerManagerRGBTable[this.hashString(workerManagerId) % workerManagerRGBTable.length];
|
|
1305
1309
|
const wkCol = chalk.default.rgb(rgbTableRow[0], rgbTableRow[1], rgbTableRow[2]);
|
|
1306
1310
|
const wkColWM = chalk.default.rgb(workerManagerRGBTableRow[0], workerManagerRGBTableRow[1], workerManagerRGBTableRow[2]);
|
|
1307
|
-
console.log(`${workerManagerId} = ${workerManagerIndex} ${JSON.stringify(this._indexTable)}`);
|
|
1308
1311
|
return wkCol(`runPrefix: [${chalk.default.bold(runPrefix)}], testType: [${chalk.default.bold(testType)}], description: [${chalk.default.bold(description)}], workerManagerId: [${wkColWM(chalk.default.bold(workerManagerId))}], Iteration: [${chalk.default.bold(iteration.toString())}]`);
|
|
1309
1312
|
};
|
|
1310
1313
|
_CheckOutputLongDurationError = (snapshotStart, message) => {
|
|
@@ -36991,25 +36994,17 @@ var AuthHelper = class extends import_tiny_emitter.TinyEmitter {
|
|
|
36991
36994
|
if (this.#accesssToken) return this.#accesssToken;
|
|
36992
36995
|
const lockKey = "GetAccessToken";
|
|
36993
36996
|
const lockTimeout = 6e4;
|
|
36994
|
-
if (this._lockHelper.GetOnHold(lockKey) === true) {
|
|
36995
|
-
|
|
36996
|
-
|
|
36997
|
-
|
|
36998
|
-
|
|
36999
|
-
this.
|
|
37000
|
-
|
|
37001
|
-
this.Debug(chalk.default.green(`GetAccessToken(): Getting existing accesssToken (post hold release), lock key: [${lockKey}]`));
|
|
37002
|
-
return this.#accesssToken;
|
|
37003
|
-
} else {
|
|
37004
|
-
this.Error(chalk.default.red(`GetAccessToken(): Could not get existing accesssToken (post hold release), lock key: [${lockKey}]`));
|
|
37005
|
-
this.Error(chalk.default.red(`GetAccessToken(): continue anyway ...`));
|
|
37006
|
-
}
|
|
37007
|
-
} catch (error) {
|
|
37008
|
-
this.Error(chalk.default.red(`GetAccessToken(): Error: [${error}]`));
|
|
36997
|
+
if (this._lockHelper.GetOnHold(lockKey) === true) try {
|
|
36998
|
+
performance.now();
|
|
36999
|
+
await this._lockHelper.WaitOnHold(lockKey, lockTimeout);
|
|
37000
|
+
if (this.#accesssToken) return this.#accesssToken;
|
|
37001
|
+
else {
|
|
37002
|
+
this.Error(chalk.default.red(`GetAccessToken(): Could not get existing accesssToken (post hold release), lock key: [${lockKey}]`));
|
|
37003
|
+
this.Error(chalk.default.red(`GetAccessToken(): continue anyway ...`));
|
|
37009
37004
|
}
|
|
37005
|
+
} catch (error) {
|
|
37006
|
+
this.Error(chalk.default.red(`GetAccessToken(): Error: [${error}]`));
|
|
37010
37007
|
}
|
|
37011
|
-
this.Debug(chalk.default.yellow(`GetAccessToken(): accesssToken does not exist - setting up new accesssToken`));
|
|
37012
|
-
this.Debug(chalk.default.yellow(`GetAccessToken(): setting hold (lock), lock key: [${lockKey}]`));
|
|
37013
37008
|
this._lockHelper.SetOnHold(lockKey);
|
|
37014
37009
|
timeout = setTimeout(() => {
|
|
37015
37010
|
this.Warning(chalk.default.magenta(`GetAccessToken(): Timeout: [${this._authMaxTimeout}] exceeded for getting access token ...`));
|
|
@@ -37027,7 +37022,6 @@ var AuthHelper = class extends import_tiny_emitter.TinyEmitter {
|
|
|
37027
37022
|
if (totalTime > this._authMaxTimeout) this.Warning(chalk.default.magenta(`GetAccessToken(): The total time for getting the access token: [${totalTime}]`));
|
|
37028
37023
|
this.#accesssToken = workingAaccesssToken;
|
|
37029
37024
|
this._lockHelper.ReleaseOnHold(lockKey);
|
|
37030
|
-
this.Debug(chalk.default.yellow(`GetAccessToken(): release hold (lock) Time taken for get access token: [${performance.now() - start}ms], lock key: [${lockKey}]`));
|
|
37031
37025
|
return this.#accesssToken;
|
|
37032
37026
|
} catch (error) {
|
|
37033
37027
|
if (timeout) clearTimeout(timeout);
|